This is the unit-testing module for Module:ar-translit.
3 of 45 tests failed. (refresh)
Text | Expected | Actual | Differs at | |
---|---|---|---|---|
اَلْعَرَبِيَّة | al-ʕarabiyya | al-ʕarabiyya | ||
اَلْعَرَبِيَّة. | al-ʕarabiyya. | al-ʕarabiyya. | ||
لِلْكِتَاب | lilkitāb | lilkitāb | ||
لِلتَّأْكِيد | (nil) | (nil) | N/A | |
لِلَّبَنِ | lillabani | lillabani | ||
لِللَّبَنِ | (nil) | (nil) | N/A | |
شْنِيتْزَل | šnītzal | šnītzal | ||
عُظْمَى | ʕuẓmā | ʕuẓmā | ||
إِحْدَى | ʔiḥdā | ʔiḥdā | ||
خَطَإٍ | ḵaṭaʔin | ḵaṭaʔin | ||
بِٱلتَّأْكِيد | bi-t-taʔkīd | bi-t-taʔkīd | ||
بِالتَّأْكِيد | bi-t-taʔkīd | bi-t-taʔkīd | ||
بِالتَأْكِيد | bi-t-taʔkīd | bi-t-taʔkīd | ||
بِالكِتَاب | bi-l-kitāb | bi-l-kitāb | ||
بِالْكِتَاب | bi-l-kitāb | bi-l-kitāb | ||
اَللُّغَةُ ٱلْعَرَبِيَّةُ | al-luḡatu l-ʕarabiyyatu | al-luḡatu l-ʕarabiyyatu | ||
اَللُّغَةُ الْعَرَبِيَّةُ | al-luḡatu l-ʕarabiyyatu | al-luḡatu l-ʕarabiyyatu | ||
نَسُوا | nasū | nasū | ||
رَمَوْا | ramaw | ramaw | ||
دَعَوُا اللّٰهَ | daʕawu llāha | (nil) | N/A | |
عَصًا | ʕaṣan | ʕaṣan | ||
هُدًى | hudan | hudan | ||
عَصاً | ʕaṣan | ʕaṣan | ||
هُدىً | hudan | hudan | ||
كاتِب | kātib | kātib | ||
كُتّاب | kuttāb | kuttāb | ||
إلاه | ʔilāh | ʔilāh | ||
كاتب | (nil) | (nil) | N/A | |
رَبّ | rabb | rabb | ||
نَوَاةٌ | nawātun | nawātun | ||
اَلشَّدَّة | aš-šadda | aš-šadda | ||
شَدَّة الشَكْل | šadda(t) aš-šakl | šadda(t) aš-šakl | ||
مُعَادَاة | muʕādāh | muʕādāh | ||
مِرْآة | mirʔāh | mirʔāh | ||
صلاح | (nil) | (nil) | N/A | |
اِيبَ | ība | ība | ||
دِيُون | diyūn | diyūn | ||
دُوِين | duwīn | duwīn | ||
الَّذِي | allaḏī | allaḏī | ||
رَأَيْتُ ابْنَهُ | raʔaytu bnahu | (nil) | N/A | |
رَأَيْتُ ٱبْنَهُ | raʔaytu bnahu | raʔaytu bnahu | ||
ڪُفُوًا | kufuwan | kufuwan | ||
أَحَدٌ ٱللّٰهُ ٱلصَّمَدُ | ʔaḥaduni llāhu ṣ-ṣamadu | ʔaḥadun llāhu ṣ-ṣamadu | 8 | |
حُووِلَ | ḥūwila | ḥūwila | ||
دُوَيْبَّة | duwaybba | duwaybba |
-- Unit tests for ]. Refresh page to run tests.
local tests = require('Module:UnitTests')
local ar_translit = require('Module:ar-translit')
local full_link = require('Module:links').full_link
local ar = require('Module:languages').getByCode('ar')
local rlm = require("Module:string/char")(0x200F) -- right-to-left mark
local function link(word)
return full_link{ term = word, lang = ar, tr = "-" }
end
--TO DO
function tests:do_test_translit(arab, roman)
self:equals(link(arab), ar_translit.tr(arab, 'ar', 'Arab'), roman)
end
function tests:test_translit_arabic()
local examples = {
{ "اَلْعَرَبِيَّة" .. rlm, "al-ʕarabiyya" }, -- right-to-left mark is removed
{ "اَلْعَرَبِيَّة.", "al-ʕarabiyya." },
{ 'لِلْكِتَاب', 'lilkitāb' }, -- ideally 'li-l-kitāb'
{ 'لِلتَّأْكِيد', nil }, -- ideally 'li-t-taʔḵīd'
{ 'لِلَّبَنِ', 'lillabani' }, -- ideally 'li-l-labani'; correct spelling
{ 'لِللَّبَنِ', nil }, -- ideally 'li-l-labani; spelling sometimes used
{ 'شْنِيتْزَل', "šnītzal" },
{ 'عُظْمَى', "ʕuẓmā" },
{ 'إِحْدَى', "ʔiḥdā" },
{ 'خَطَإٍ', "ḵaṭaʔin" },
-- cases with bi- prefix plus definite article
{ 'بِٱلتَّأْكِيد', "bi-t-taʔkīd" },
{ 'بِالتَّأْكِيد', "bi-t-taʔkīd" },
{ 'بِالتَأْكِيد', "bi-t-taʔkīd" },
{ 'بِالكِتَاب', "bi-l-kitāb" },
{ 'بِالْكِتَاب', "bi-l-kitāb" },
-- check handling of ʔiʕrāb, hamzatu l-waṣl w/al-, al- w/sun and moon letters
{ 'اَللُّغَةُ ٱلْعَرَبِيَّةُ', "al-luḡatu l-ʕarabiyyatu" },
-- check elision of al- after a vowel
{ 'اَللُّغَةُ الْعَرَبِيَّةُ', "al-luḡatu l-ʕarabiyyatu" },
-- check two kinds of otiose alif in 3rd-masc-plural endings
{ 'نَسُوا', "nasū" },
{ 'رَمَوْا', "ramaw" },
{ 'دَعَوُا اللّٰهَ', "daʕawu llāha" },
-- check otiose alif and alif maqṣūra after fatḥatan
{ 'عَصًا', "ʕaṣan" },
{ 'هُدًى', "hudan" },
-- same where fatḥatan wrongly placed over alif or alif maqṣūra
{ 'عَصاً', "ʕaṣan" },
{ 'هُدىً', "hudan" },
-- infer fatḥa on alif between consonants
{ 'كاتِب', "kātib" },
-- infer fatḥa on alif between consonants when first is marked with shadda
{ 'كُتّاب', "kuttāb" },
-- infer kasra after hamza-under-alif
{ 'إلاه', "ʔilāh" },
-- missing diacritic on t
{ 'كاتب', nil },
-- final shadda on unvocalized consonant
{ 'رَبّ', "rabb" },
-- tā' marbūṭa preceded by alif; don't infer fatḥa
{ 'نَوَاةٌ', "nawātun" },
-- alif-lam w/unvocalized lam + shadda over sun letter; final tāʔ marbūṭa
{ 'اَلشَّدَّة', "aš-šadda" },
-- medial tāʔ marbūṭa
{ 'شَدَّة الشَكْل', "šadda(t) aš-šakl" },
-- alif + tāʔ marbūṭa --> āh
{ 'مُعَادَاة', "muʕādāh" },
-- alif madda + tāʔ marbūṭa --> āh
{ 'مِرْآة', "mirʔāh" },
-- test of h for the constant
{ 'صلاح', nil },
-- initial unhamzated alif + ī
{ 'اِيبَ', "ība" },
-- iyū sequence
{ 'دِيُون', "diyūn" },
-- uwī sequence
{ 'دُوِين', "duwīn" },
-- allaḏī, with al + shadda
{ 'الَّذِي', "allaḏī" },
-- alif al-wasl
{ 'رَأَيْتُ ابْنَهُ', "raʔaytu bnahu" },
{ 'رَأَيْتُ ٱبْنَهُ', "raʔaytu bnahu" },
-- "swash kaf"
{ 'ڪُفُوًا', "kufuwan" },
{ 'أَحَدٌ ٱللّٰهُ ٱلصَّمَدُ', "ʔaḥaduni llāhu ṣ-ṣamadu" },
{ 'حُووِلَ', "ḥūwila" },
{ 'دُوَيْبَّة', "duwaybba" },
}
self:iterate(examples, "do_test_translit")
end
return tests