Module:yue-pron/testcases

local tests = require("Module:UnitTests")

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

local function code(text) return ' ' end

local function link(text) return ' ' .. text .. ' ' end

local function tag_IPA (IPA) return ' ' .. IPA .. ' ' 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