Module:ar-translit/testcases: difference between revisions

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Content deleted Content added
No edit summary
I think this should be good a goal
Line 64: Line 64:
-- allaḏī, with al + shadda
-- allaḏī, with al + shadda
self:do_test_translit('الَّذِي', "allaḏī")
self:do_test_translit('الَّذِي', "allaḏī")
-- alif al-wasl
self:do_test_translit('رَأَيْتُ ابْنَهُ', "raʾaytu bnahu")
self:do_test_translit('رَأَيْتُ اِبْنَهُ', "raʾaytu ibnahu")
end
end

Revision as of 15:40, 6 July 2016

This is the unit-testing module for Module:ar-translit.

1 of 0 tests failed. (refresh)

TextExpectedActualDiffers at
test_translit_arabic:
Script error during testing: Module:links:787: The first argument to the function full_link must be a table. See Module:links/documentation for more information.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:links:787: in function 'full_link'
	Module:ar-translit/testcases:8: in function 'do_test_translit'
	Module:ar-translit/testcases:13: in function <Module:ar-translit/testcases:11>
	(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:856: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

-- Unit tests for [[Module:ar-translit]]. Refresh page to run tests.
local tests = require('Module:UnitTests')
local ar_translit = require('Module:ar-translit')
local m_links = require('Module:links')

--TO DO
function tests:do_test_translit(arab, roman, xlit)
	self:equals(m_links.full_link(arab, nil, require('Module:languages').getByCode('ar'), nil, nil, nil, {}, true), ar_translit.tr(arab, 'ar', 'Arab'), roman)
end

function tests:test_translit_arabic()

	self:do_test_translit('شْنِيتْزَل', "šnītzal")
	self:do_test_translit('عُظْمَى', "ʿuẓmā")
	self:do_test_translit('إِحْدَى', "ʾiḥdā")
	-- cases with bi- prefix plus definite article
	self:do_test_translit('بِٱلتَّأْكِيد', "bi-t-taʾkīd")
	self:do_test_translit('بِالتَّأْكِيد', "bi-t-taʾkīd")
	self:do_test_translit('بِالتَأْكِيد', "bi-t-taʾkīd")
	self:do_test_translit('بِالكِتَاب', "bi-l-kitāb")
	self:do_test_translit('بِالْكِتَاب', "bi-l-kitāb")
	-- check handling of ʾiʿrāb, hamzatu l-waṣl w/al-, al- w/sun and moon letters
	self:do_test_translit('اَللُّغَةُ ٱلْعَرَبِيَّةُ', "al-luḡatu l-ʿarabiyyatu")
	-- check elision of al- after a vowel
	self:do_test_translit('اَللُّغَةُ الْعَرَبِيَّةُ', "al-luḡatu l-ʿarabiyyatu")

	-- check two kinds of otiose alif in 3rd-masc-plural endings	
	self:do_test_translit('نَسُوا', "nasū")
	self:do_test_translit('رَمَوْا', "ramaw")
	-- check otiose alif and alif maqṣūra after fatḥatan
	self:do_test_translit('عَصًا', "ʿaṣan")
	self:do_test_translit('هُذًى', "huḏan")
	-- same where fatḥatan wrongly placed over alif or alif maqṣūra
	self:do_test_translit('عَصاً', "ʿaṣan")
	self:do_test_translit('هُذىً', "huḏan")
	-- infer fatḥa on alif between consonants
	self:do_test_translit('كاتِب', "kātib")
	-- infer fatḥa on alif between consonants when first is marked with shadda
	self:do_test_translit('كُتّاب', "kuttāb")
	-- infer kasra after hamza-under-alif
	self:do_test_translit('إلاه', "ʾilāh")
	-- missing diacritic on t
	self:do_test_translit('كاتب', nil)
	-- final shadda on unvocalized consonant
	self:do_test_translit('رَبّ', "rabb")
	-- tā' marbūṭa preceded by alif; don't infer fatḥa
	self:do_test_translit('نَوَاةٌ', "nawātun")
	-- alif-lam w/unvocalized lam + shadda over sun letter; final tāʾ marbūṭa
	self:do_test_translit('اَلشَّدَّة', "aš-šadda")
	-- medial tāʾ marbūṭa
	self:do_test_translit('شَدَّة الشَكْل', "šadda(t) aš-šakl")
	-- alif + tāʾ marbūṭa --> āh
	self:do_test_translit('مُعَادَاة', "muʿādāh")
	-- alif madda + tāʾ marbūṭa --> āh
	self:do_test_translit('مِرْآة', "mirʾāh")
    -- test of h for the constant
	self:do_test_translit('صلاح', nil)
	-- initial unhamzated alif + ī
	self:do_test_translit('اِيبَ', "ība")
	-- iyū sequence
	self:do_test_translit('دِيُون', "diyūn")
	-- uwī sequence
	self:do_test_translit('دُوِين', "duwīn")
	-- allaḏī, with al + shadda
	self:do_test_translit('الَّذِي', "allaḏī")
	-- alif al-wasl
	self:do_test_translit('رَأَيْتُ ابْنَهُ', "raʾaytu bnahu")
	self:do_test_translit('رَأَيْتُ اِبْنَهُ', "raʾaytu ibnahu")
end
 
return tests