Module:yue-pron/testcases
Jump to navigation
Jump to search
- The following documentation is located at Module:yue-pron/testcases/documentation. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
2 of 2 tests failed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
jau3 zi6 jyun4-2 (幼稚園) | jɐu̯˧ t͡siː˨ jyːn˨˩꜔꜒ | jɐu̯³³ t͡siː²² jyːn²¹⁻³⁵ | |
zung1 waa4 (中華) | t͡sʊŋ˥ wɑː˨˩ | t͡sʊŋ⁵⁵ waː²¹ |
local tests = require("Module:UnitTests")
local m_pron = require("Module:yue-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(yue, zh)
return code(yue) .. " (" .. link(zh) .. ")"
end
local function remove_html(text)
text = text:gsub("<[^>]+>", "")
return text
end
local options = { display = tag_IPA, show_difference = true }
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), remove_html(func(example)), actual, options)
end
end
function tests:test_IPA_conv()
local examples = {
{ "jau3 zi6 jyun4-2", "幼稚園", "jɐu̯˧ t͡siː˨ jyːn˨˩꜔꜒" },
{ "zung1 waa4", "中華", "t͡sʊŋ˥ wɑː˨˩" },
}
self:iterate(examples, self:check("jyutping_to_ipa"))
end
return tests