Module:sce-pron/testcases
Appearance
- This module testcase page lacks a documentation subpage. Please create it.
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
local tests = require("Module:UnitTests")
local m_IPA = require("Module:sce-pron")
local gsub = mw.ustring.gsub
local sce = require("Module:languages").getByCode("sce")
local function link(text)
return require("Module:links").full_link { term = text, lang = sce }
end
local function respell(term)
local original_term = term
term = gsub(term, "'", ""):gsub("ŋ", "n")
return term, original_term ~= term and term or nil
end
function tests:test_phonemic_IPA()
local testcases = {
{ "baer", "pɑˈɚ" },
{ "tiigha", "tʰɯˈqɑ" },
{ "niere", "njəˈrə" },
{ "enzhegve", "ənt͡ʂəˈʁə" },
{ "xiaojieruŋ", "ɕjɑwt͡ɕjəˈruŋ" },
{ "'ershi", "ˈɚʂi", "zh" },
{ "'ruhher", "ˈʐuhɚ", "zh" }
}
local options = {
display = function(IPA)
return '<span class="IPA">/' .. IPA .. '/</span>'
end
}
self:iterate(testcases, function(self, term, IPA, etyl)
local respelt, is_respelt = respell(term)
if is_respelt then
self:equals(link(respelt) .. " (<code>" .. term .. "</code>)", m_IPA.IPA_m(term, etyl), IPA, options)
else
self:equals(link(term), m_IPA.IPA_m(term, etyl), IPA, options)
end
end)
end
return tests