Module:fa-cls-translit/testcases
- පහත දැක්වෙන උපදෙස්, Module:fa-cls-translit/testcases/documentation හි පිහිටා ඇත. [සංස්කරණය] Categories were auto-generated by Module:module categorization. [edit]
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • tested module • sandbox
This is the unit testing module for Module:fa-cls-translit.
1 of 8 tests failed. (refresh)
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
سَرْاَنْجَام | sar-anjām | sar-anjām | ||
کُروز | kurōz | kurōz | ||
دَهْ | dah | dah | ||
دَه | da | da | ||
سُؤَال | su'āl | su'āl | ||
کُرُوز | kurūz | kurūz | ||
وَاوْ | wāw | wāw | ||
نَوْروز | nawrōz | nawrōz | ||
Script error during testing: Module:languages:690: attempt to index local 'sc' (a nil value)stack traceback: [C]: ? Module:languages:690: in function 'findBestScript' Module:links:825: in function <Module:links:782> (tail call): ? Module:fa-cls-translit/testcases:12: in function 'func' Module:UnitTests:295: in function 'iterate' Module:fa-cls-translit/testcases:96: in function <Module:fa-cls-translit/testcases:15> (tail call): ? [C]: in function 'xpcall' Module:UnitTests:369: in function <Module:UnitTests:328> (tail call): ? mw.lua:527: in function <mw.lua:507> [C]: ? [C]: in function 'expandTemplate' mw.lua:333: in function 'expandTemplate' Module:documentation:877: in function 'chunk' mw.lua:527: in function <mw.lua:507> [C]: ? |
-- Unit tests for [[Module:fa-cls-translit]]. Refresh page to run tests.
local tests = require('Module:UnitTests')
local fa_translit = require('Module:fa-cls-translit')
local m_links = require('Module:links')
local fa = require('Module:languages').getByCode('fa')
local function link(term)
return m_links.full_link{term = term, lang = fa}
end
function tests:do_test_translit(Pers, roman, xlit)
self:equals(link(Pers), fa_translit.tr(Pers, 'fa', 'fa-Arab'), roman)
end
function tests:test_translit_persian()
local examples = {
{ 'سَرْاَنْجَام', "sar-anjām" },
{ 'کُروز', "kurōz" },
{ 'دَهْ', "dah"}, --always "h" near a vowel
{ 'دَه', "da"}, --always a when theres no vowel
{ 'سُؤَال', "su'āl" },
{ 'کُرُوز', "kurūz" }, -- this word is intentionally incorrect
{ 'وَاوْ', "wāw" },
{'نَوْروز', "nawrōz"},
{ 'قَهْوَهاِی', "qahwa-ī" }, -- case for هَای as a-'ī can be changed to yī
{ 'قَهْوَهیِی', "qahwa-yī" }, -- case for هیِی as a-'ī
{'خْوَانْدَن', "xwāndan"}, -- case for خوَا as xwā
{'خْویش', "xwēš"},
{'خْوَد', "xwad"}, -- case for خو as xo (Iranian Persian) and xwad (Classical Persian)
{ 'چَامَهسَرَایِی', "čāma-sarāyī" },
{ 'طَنِین', "tanīn" },
{ 'لِهٰذَا', "lihāzā" }, -- can be lehāzā if majhul diacritics are shown
{ 'عَصاً', "'asan" },
{ 'خَانَه', "xāna" },
{ 'کورِیَایِ شُمَالِی', "kōriyā-yi šumālī" },
{ 'ضَمَّه', "zamma" },
{ 'ضَمِّهْ', "zammih" }, -- force include final -h with diacritics
{ 'کِه', "ki"},
{ 'کِهْ', "kih" }, -- another example of forcing the h
{ 'اَرْمَنِسْتَان', "armanistān" },
{ 'بَاکُو', "bākū" },
{ 'کَسی', "kasē"}, --word final -ē
{"بَرَادَرِ بُزُرْگ", "barādar-i buzurg"}, -- izafa/ezafe marked with a dash -
{'قُرُونِ وُسْطیٰ', "qurūn-i wustā" }, -- a dagger alif case
{'دَر-آمَد', "dar-āmad" }, -- alif madda test
{ 'بَازِیِ شَطْرَنْج', "bāzī-yi šatranj" },
{ 'ایرَانِیَان', "ērāniyān"},
{ 'سُؤَال', "su'āl"}, --if majhul diacritics are used then so'āl
{ 'صُبَاح', "subāh" },
{ 'صُبْح', "subh"},
{ 'صُبْه', "subh"}, --purposefully mispelt
{ "دُروغ گویْ", "durōğ gōy"}, --have semivowels become consonts with jazm
{ 'او', "ō" }, -- transliteration of wa, beginning of sentence
{ 'وَ', "wa" }, --transliteration of wa, elsewhere (requires two spaces on both sides)
{ ' و ', " u " },
{ 'بَه نَامِ خُدَا', "ba nām-i xudā"},
{ 'جَوَانِی', "jawānī"},
{ 'شَاهْنَامَه', "šāhnāma"},
{ 'زِنْدَگِی', "zindagī"},
{ 'زِنْدَهگِی', "zinda-gī"},
{ 'میوَهٔ جَاپَانِی', "mēwa-yi jāpānī" },
{ 'نُوید', "nuwēd"}, -- nawīd/navid in modern Persian
{ 'دُخْتَرَْبَچَّه',"duxtar-bačča"},
{ 'کِیَه', "kiya" },
{ 'کُرُوَاسِیَا', "kuruwāsiyā" }, --moderate vowel test
{ 'مِیَایِین', "miyāyīn"}, -- more complex vowel test
{ 'مْیَایین', "myāyēn"}, -- more complex vowel test
{ 'طِلَّا', "tillā" },
{ 'لیکِن', "lēkin" },
{ 'بَچَّهٔ لَطِیفَه کَلَان اَسْت', "bačča-yi latīfa kalān ast" },
{ 'مَعْرُوف و مَجْهُول', "ma'rūf u majhūl"},
{ 'مَعْرُوف وَ مَجْهُول', "ma'rūf wa majhūl"},
{ 'اَرمنستان', nil },
{ 'باکو', nil },
{ 'کسی', nil }, --word final -ē
{"برادر بزرگ", nil }, -- izafa/ezafe marked with a dash -
{'قرون وسطی', nil }, -- a dagger alif
{'وَٱللّٰه', "wallāh"}, --alef_wasla
-- uncommon characters
{'آیَةُاللّٰه',
'āyatu-llāh'},
{'فِالْحَال',
'fi-l-hāl'},
{'کَسے',
'kasē'},
{'کَٹَه',
'kaṭa'},--hazaragi
{'بویِ تُو',
'bō-yi tū'},
{'بِسْمِ اللّٰهِ الْرَّحْمٰنِ الْرَّحِیم',
'bism-i llāh-i rrahmān-i rrahīm'},
{'اِیَالَاتِ مُتَّحِدَه',
'iyālāti muttahida'}
}
self:iterate(examples, "do_test_translit")
end
return tests