Module:sk-IPA/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

4 of 14 tests failed. (refresh)

TextExpectedActual
test_all:
Passedmäsoˈmɛɐ̯sɔˈmɛɐ̯sɔ
Passedďakovaťˈɟakɔvacˈɟakɔvac
Passedchliebxʎi̯epxʎi̯ep
Passedštvrťʃtvr̩cʃtvr̩c
Passedvĺčaˈvl̩ːt͡ʃaˈvl̩ːt͡ʃa
Passedvŕbaˈvr̩ːbaˈvr̩ːba
Passedkôňku̯oɲku̯oɲ
Failedčlnt͡ʃl̩nt͡ʃln
Failedšmrncʃmr̩nt͡sʃmrn̩t͡s
Faileddetstvoˈɟet͡stvɔˈɟetstvɔ
Passedletoˈʎetɔˈʎetɔ
Passedneboˈɲebɔˈɲebɔ
Passeddetiˈɟeciˈɟeci
Faileddabingˈdabiŋkˈdabink

local tests = require('Module:UnitTests')
local m_IPA = require('Module:sk-IPA')
local m_links = require("Module:links")

local lang = require("Module:languages").getByCode("sk")
local sc = require("Module:scripts").getByCode("Latn")

local function tag_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end

function tests:check_output(term, expected)
	tests:equals(
		m_links.full_link({ term = term, lang = lang, sc = sc } ),
		m_IPA.toIPA(term),
		expected,
		{ display = tag_IPA }
	)
end

function tests:test_all()
	local examples = {
		{ "mäso", "ˈmɛɐ̯sɔ" },
		{ "ďakovať", "ˈɟakɔvac" },
		{ "chlieb", "xʎi̯ep" },
		{ "štvrť", "ʃtvr̩c" },
		{ "vĺča", "ˈvl̩ːt͡ʃa" },
		{ "vŕba", "ˈvr̩ːba" },
		{ "kôň", "ku̯oɲ" },
		{ "čln", "t͡ʃl̩n" },
		{ "šmrnc", "ʃmr̩nt͡s" },
		-- palatalisation is expected for d, t, n and l before e and i (there are exceptions to be respelled)
		{ "detstvo", "ˈɟet͡stvɔ" },
		{ "leto", "ˈʎetɔ" },
		{ "nebo", "ˈɲebɔ" },
		{ "deti", "ˈɟeci" },
		-- n should become ŋ before k and g
		{ "dabing", "ˈdabiŋk" },
	}
	self:iterate(examples, "check_output")
--[[	additions take this form:
		{ "", "" },
	]]
end

return tests