Jump to content

Module:ilo-pron/testcases

From Wiktionary, the free dictionary

All tests passed. (refresh)

TextExpectedActual
test_phonetic_pron:
Passedaldáwʔɐlˈdaʊ̯ʔɐlˈdaʊ̯
Passedbaláybɐˈlaɪ̯bɐˈlaɪ̯
Passedbituénbiˈtwenbiˈtwen
PassedDiosˈd͡ʒosˈd͡ʒos
PassedEstados Unidosʔesˌta.dos ʔuˈni.dosʔesˌta.dos ʔuˈni.dos
Passedestasiónʔes.tɐˈʃonʔes.tɐˈʃon
Passedinómʔiˈnomʔiˈnom

tests = require("Module:UnitTests")
local m_ilo_pron = require("Module:ilo-pron")
local m_links = require('Module:links')

local options = { display = tag_IPA }

local ilo = require('Module:languages').getByCode('ilo')

local function ilo_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end
local function link(text)
	return m_links.full_link{ term = text, lang = ilo }
end

function tests:check_phonetic_ipa(word, expected, respelling)
	self:equals(
		link(word)  ..
			(respelling and (" (respelled " .. respelling .. ")") or ""),
		m_ilo_pron.IPA(word or respelling, true),
		expected,
		{ display = tag_IPA }
	)
end

function tests:test_phonetic_pron()
	local examples = {
        { "aldáw","ʔɐlˈdaʊ̯" },
        { "baláy","bɐˈlaɪ̯" },
        { "bituén","biˈtwen" },
        { "Dios","ˈd͡ʒos" },
        { "Estados Unidos", "ʔesˌta.dos ʔuˈni.dos" },
        { "estasión","ʔes.tɐˈʃon"},
        { "inóm","ʔiˈnom"},
	}
	self:iterate(examples, "check_phonetic_ipa")
end

return tests