Module:fa-translit/testcases
Appearance
- The following documentation is located at Module:fa-translit/testcases/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
This is the unit-testing module for Module:fa-translit.
All tests passed. (refresh)
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
گویَا کِه | gōyā ki/guyâ ke | gōyā ki/guyâ ke | ||
حُقُوق | huqūq/hoğuğ | huqūq/hoğuğ | ||
دَقِیقَه | daqīqa/dağiğe | daqīqa/dağiğe | ||
خْوَرَاسَان | xwarāsān/xorâsân | xwarāsān/xorâsân | ||
خْویش | xwēš/xiš | xwēš/xiš | ||
روز | rōz/ruz | rōz/ruz | ||
وَلیکِن | walēkin/valiken | walēkin/valiken | ||
شُویْ | šūy/šuy | šūy/šuy | ||
شویْ | šōy/šuy | šōy/šuy | ||
شِیر | šīr/šir | šīr/šir | ||
شیر | šēr/šir | šēr/šir | ||
شَوْهَر | šawhar/šowhar | šawhar/šowhar | ||
کَسی | kasē/kasi | kasē/kasi | ||
گویِش | gōyiš/guyeš | gōyiš/guyeš | ||
بَیْنُالمِلَلِی | baynu-l-milalī/beyno-l-melali | baynu-l-milalī/beyno-l-melali | ||
شَوِی | šawī/šavi | šawī/šavi | ||
شِوِی | šiwī/ševi | šiwī/ševi | ||
شُوی | šuwē/šovi | šuwē/šovi | ||
خْوَدْرَو | xwadraw/xodrow | xwadraw/xodrow | ||
حقوق | (nil) | (nil) | N/A | |
عشق | (nil) | (nil) | N/A | |
نَمیدَانَم/نِمیدَانَم | namē-dānam/nemi-dânam | namē-dānam/nemi-dânam | ||
خَانَگِی/خَانِگِی | xānagī/xânegi | xānagī/xânegi | ||
موز/مَوْز | mōz/mowz | mōz/mowz |
-- Unit tests for [[Module:fa-translit]]. Refresh page to run tests.
local tests = require('Module:UnitTests')
local fa_translit = require('Module:fa-translit')
local full_link = require('Module:links').full_link
local fa = require('Module:languages').getByCode('fa')
local trsp = "<span class=\"Zsym mention\" style=\"font-size:85%;\">/</span>"
local rlm = require("Module:string/char")(0x200F) -- right-to-left mark
local function link(word)
return full_link{ term = word, lang = fa, tr = "-" }
end
--TO DO
function tests:do_test_translit(arab, roman)
self:equals(link(arab), fa_translit.tr(arab, 'fa', 'Persian'), roman)
end
function tests:test_translit_persian()
local examples = {
{ 'گویَا کِه', 'gōyā ki' .. trsp .. 'guyâ ke' },
{ 'حُقُوق', 'huqūq' .. trsp .. 'hoğuğ' },
{ 'دَقِیقَه', 'daqīqa' .. trsp .. 'dağiğe' },
{ 'خْوَرَاسَان', 'xwarāsān' .. trsp .. 'xorâsân' },
{ 'خْویش', 'xwēš' .. trsp .. 'xiš' },
{ 'روز', 'rōz' .. trsp .. 'ruz' },
{ 'وَلیکِن', 'walēkin' .. trsp .. 'valiken' },
{ 'شُویْ', 'šūy' .. trsp .. 'šuy' },
{ 'شویْ', 'šōy' .. trsp .. 'šuy' },
{ 'شِیر', 'šīr' .. trsp .. 'šir' },
{ 'شیر', 'šēr' .. trsp .. 'šir' },
{ 'شَوْهَر', 'šawhar' .. trsp .. 'šowhar' },
{ 'کَسی', 'kasē' .. trsp .. 'kasi' },
{ 'گویِش', 'gōyiš' .. trsp .. 'guyeš' },
{ 'بَیْنُالمِلَلِی', 'baynu-l-milalī' .. trsp .. 'beyno-l-melali' },
{ 'شَوِی', 'šawī' .. trsp .. 'šavi' },
{ 'شِوِی', 'šiwī' .. trsp .. 'ševi' },
{ 'شُوی', 'šuwē' .. trsp .. 'šovi' },
{ 'خْوَدْرَو', 'xwadraw' .. trsp .. 'xodrow' },
-- should return nil
{ 'حقوق', nil },
{ 'عشق', nil },
-- tests for vocalization override
{ 'نَمیدَانَم//نِمیدَانَم', 'namē-dānam' .. trsp .. 'nemi-dânam' },
{ 'خَانَگِی//خَانِگِی', 'xānagī' .. trsp .. 'xânegi' },
{ 'موز//مَوْز', 'mōz' .. trsp .. 'mowz' },
}
self:iterate(examples, "do_test_translit")
end
return tests