Aller au contenu

Module:ar-pronunciation/testcases

Définition, traduction, prononciation, anagramme et synonyme sur le dictionnaire libre Wiktionnaire.

2 tests ont échoué (rafraichir)

  Texte Attendu Obtenu
test1_transliteration :
Failed Erreur de script pendant le test : Module:ar-pronunciation/testcases:80: attempt to call method 'iterate' (a nil value)
stack traceback:
	[C]: in function 'iterate'
	Module:ar-pronunciation/testcases:80: in function <Module:ar-pronunciation/testcases:71>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:293: in function <Module:UnitTests:239>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
  Texte Attendu Obtenu
test_Arabic :
Failed Erreur de script pendant le test : Module:ar-pronunciation/testcases:68: attempt to call method 'iterate' (a nil value)
stack traceback:
	[C]: in function 'iterate'
	Module:ar-pronunciation/testcases:68: in function <Module:ar-pronunciation/testcases:24>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:293: in function <Module:UnitTests:239>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?



local tests = require("Module:UnitTests")
local m_IPA = require("Module:ar-pronunciation")

local function tag_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end

local function not_Latin(text)
	return not string.find(text, "[a-z]")
end

local options = { display = tag_IPA, show_difference = true }
function tests:check_output(term, expected, comment)
	options.comment = comment
	local is_Arabic = not_Latin(term)
	self:equals(
		is_Arabic and m_IPA.link(term) or term,
		m_IPA.toIPA(is_Arabic and { Arabic = term } or { tr = term}, true),
		expected,
		options
	)
end

function tests:test_Arabic()
	local examples = {
		{ "طَبَّ", "tˁab.ba" },
		{ "رُوسِيَا", "ruː.si.jaː" },
		{ "أَنْتَ", "ʔan.ta" },
		{ "ذٰلِكَ", "ðaː.li.ka" },
		{ "صَغِير", "sˁa.ɣiːr" },
		{ "إِصْبَع", "ʔisˁ.baʕ" },
		{ "عَلَى", "ʕa.laː" },
		{ "جَزِيرَة", "d͡ʒa.ziː.ra" },
		{ "أَرْبَعَة", "ʔar.ba.ʕa" },
		{ "حُبّ", "ħubb" },
		{ "عَرَبِيّ", "ʕa.ra.bijj" },
		{ "خَاصّ", "χaːsˁsˁ" },
		{ "خَاصَّة", "χaːsˁ.sˁa" },
		"Allah",
		{ "اللّٰه", "aɫ.ɫaːh", "special case" },
		{ "عَبْدُ اللّٰه", "ʕab.du‿ɫ.ɫaːh", "special case" },
		{ "لِلّٰه", "lil.laːh", "special case of the special case" },
		"Phrases",
		{
			"الْمَمْلَكَة الْعَرَبِيَّة السُّعُودِيَّة",
			"al.mam.la.ka‿l.ʕa.ra.bij.ja‿s.su.ʕuː.dij.ja"
		},
		{"مَعَ اَلسَّلَامَة", "ma.ʕa‿s.sa.laː.ma"},
		{
			"لٰكِنَّ الرَّئِيسَ كَانَ أَذْكَى مِمَّا تَوَقَّعَ النَّاسُ",
			"laː.kin.na‿r.ra.ʔiː.sa kaː.na ʔað.kaː mim.maː ta.waq.qa.ʕa‿n.naː.su"
		},
		{ "بِسْمِ اللهِ الرَّحْمٰنِ الرَّحِيمِ", "bis.mi‿l.laː.hi‿r.raħ.maː.ni‿r.ra.ħiː.mi" },
		{ "إِنْ شَاءَ ٱللَٰهُ", "ʔin ʃaː.ʔa‿ɫ.ɫaː.hu" },
		{ "بِٱلْهَنَاءِ وَٱلشِّفَاء", "bil.ha.naː.ʔi waʃ.ʃi.faːʔ" },
		"vowel shortening",
		{ "فِي الْبَيْت", "fi‿l.bajt" },
		{ "مَا ٱسْمُك", "ma‿s.muk" },
		{ "ذُو الْقَرْنَيْن", "ðu‿l.qar.najn" },
		{ "إِلَّا الله", "ʔil.la‿ɫ.ɫaːh" },
		{ "فِي ٱتِّحَادِنَا", "fi‿t.ti.ħaː.di.naː" },
		{ "فِي الله", "fi‿l.laːh" },
--[[	Copy the following to add more examples:
		{ "", "" },
]]
	}
	
	self:iterate(examples, "check_output")
end

function tests:test1_transliteration()
	local examples = {
		{ "tilivizyōn", "ti.li.viz.joːn" },
		{ "ʾinglīziyy", "ʔinɡliː.zijj" },		
--[[	Copy the following to add more examples:
		{ "", "" },
]]
	}
	
	self:iterate(examples, "check_output")
end

return tests