Module:wuu-pron/testcases

1 of 0 tests failed. (refresh)

TextExpectedActual
test_IPA_conv:
Script error during testing: Module:wuu-pron/testcases:23: No function called "ipa_conv" in Module:wuu-pron.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:wuu-pron/testcases:23: in function 'check'
	Module:wuu-pron/testcases:34: in function <Module:wuu-pron/testcases:29>
	(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]: ?

local tests = require("Module:UnitTests")

local m_pron = require("Module:wuu-pron")

local function code(text)
	return '<code>' .. text .. '</code>'
end

local function link(text)
	return '<span class="Hani" lang="zh">[[' .. text .. '#Chinese|' .. text .. ']]</span>'
end

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

local function show(wuu, zh)
	return code(wuu) .. " (" .. link(zh) .. ")"
end

local options = { display = tag_IPA }
function tests:check(funcName)
	local func = m_pron[funcName] or error('No function called "' .. funcName .. '" in Module:wuu-pron.')
	return function (self, example, entry, actual)
		self:equals(show(example, entry), func(example), actual, options)
	end
end

function tests:test_IPA_conv()
	local examples = {
		{ "2'ieu zu hhyoe", "幼稚園", "ʔiɜ³³ z̻v̩ʷ⁵⁵ ɦyø²¹" }, -- 幼稚園
		{ "1tson hho", "中華", "t͡sʊŋ⁵⁵ ɦo²¹" },
	}
	self:iterate(examples, self:check("ipa_conv"))
end

return tests