Module:kip-IPA/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

1 of 0 tests failed. (refresh)

TextExpectedActualComments
test_phonetic:
Script error during testing: Module:kip-IPA:90: attempt to concatenate global 'Kham' (a nil value)
stack traceback:
	[C]: ?
	Module:kip-IPA:90: in function 'toIPA'
	Module:kip-IPA/testcases:15: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:kip-IPA/testcases:33: in function <Module:kip-IPA/testcases:21>
	(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:894: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tests = require("Module:UnitTests")
local m_IPA = require("Module:kip-IPA")

local function tag_IPA(IPA)
		if phonetic then
			IPA = '/' .. IPA .. '/'
		else
			IPA = '[' .. IPA .. ']'
		end
	return '<span class="IPA">' .. IPA .. '</span>'
end
function tests:check_output(term, expected, comment)
	self:equals(
		m_IPA.link(term),
		tag_IPA(m_IPA.toIPA(term, "standard")),
		tag_IPA(expected),
		{ comment = comment }
	)
end

function tests:test_phonetic()
	examples = {
        { "ज़ा", "zɐ" },
        { "झङ", "d͡zə̤ŋ" },
        { "झ़ार", "zɐ̤r" },
        { "व़ाः", "ɥɐ̤" },
        { "ह्व़े", "ɥ̊e" },
        { "ह्लेपा", "ɬe.pɐ" },
        { "बोङ्दै", "boŋ.dəj" },
        { "कलिःङ्गा", "kə.li̤ŋ.ɡɐ" },
        { "चोः", "t͡so̤" },
	}
tests:iterate(examples, "check_output")

end

return tests