Module:sce-pron/testcases

Hello, you have come here looking for the meaning of the word Module:sce-pron/testcases. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:sce-pron/testcases, but we will also tell you about its etymology, its characteristics and you will know how to say Module:sce-pron/testcases in singular and plural. Everything you need to know about the word Module:sce-pron/testcases you have here. The definition of the word Module:sce-pron/testcases will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:sce-pron/testcases, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.


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