Module:siwa-pron/testcases: Difference between revisions

From Linguifex
Jump to navigation Jump to search
No edit summary
No edit summary
Line 12: Line 12:
function tests:check_output(term, expected, noresp)
function tests:check_output(term, expected, noresp)
return tests:equals(
return tests:equals(
noresp and linkup(noresp) .. "<br>(" .. term .. ")" or linkup(term),
linkup(gsub(term,"·","")),
m_IPA.crux(term),
m_IPA.crux(term),
expected,
expected,
Line 49: Line 49:
{"nedġi", "ˈnɛðxi"},
{"nedġi", "ˈnɛðxi"},
{"Teltsġvi", "ˈtʰɛɬt͡sxwi"},
{"Teltsġvi", "ˈtʰɛɬt͡sxwi"},
{"uįo·kỏesġen", "ˌujɔˈk⁽ʰ⁾ʊːɛsxɛn", "uįokỏesġen"},
{"uįo·kỏesġen", "ˌujɔˈk⁽ʰ⁾ʊːɛsxɛn"},
{"hait", "ˈhaɪʔɪ"},
{"hait", "ˈhaɪʔɪ"},
{"siaun", "ˈsɪaʊn"}, --made-up word to test triphthongs in the form -C#
{"siaun", "ˈsɪaʊn"}, --made-up word to test triphthongs in the form -C#
{"vihi", "ˈviʔi"},
{"vihi", "ˈviʔi"},
--[[{"", ""},
{"keika", "ˈcʰeiɡa"},
{"i·sallusi", "ˌiˈsɑlːusi"},
{"ỉhhįõ", "ˈihːjɔ̃"},
{"gam·ġoġuana", "gaˈmxɔxuɑna"},
{"", ""},
{"", ""},
{"", ""},
{"", ""},
Line 70: Line 73:
{"", ""},
{"", ""},
{"", ""},
{"", ""},
{"", ""},
{"", ""},
{"", ""},]]
}
}
self:iterate(list, "check_output")
self:iterate(list, "check_output")

Revision as of 14:54, 6 January 2021


1 test failed. (refresh)
Text Expected Actual
test_example:
Script error during testing: Module:siwa-pron/testcases:14: attempt to call global 'gsub' (a nil value)
stack traceback:
	Module:siwa-pron/testcases:14: in function 'func'
	Module:UnitTests:247: in function 'iterate'
	Module:siwa-pron/testcases:76: in function <Module:siwa-pron/testcases:21>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:299: in function <Module:UnitTests:261>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	(tail call): ?
	[C]: in function 'xpcall'
	...cribunto/includes/engines/LuaStandalone/MWServer.lua:99: in function 'handleCall'
	...cribunto/includes/engines/LuaStandalone/MWServer.lua:313: in function 'dispatch'
	...cribunto/includes/engines/LuaStandalone/MWServer.lua:52: in function 'execute'
	...Scribunto/includes/engines/LuaStandalone/mw_main.lua:7: in main chunk
	[C]: ?

local tests = require('Module:UnitTests')
local m_IPA = require('Module:siwa-pron')

local function IPA_style(IPA)
	return '<span style="font-size:110%;font-family:Gentium,\'DejaVu Sans\',\'Segoe UI\',sans-serif>' .. IPA .. '</span>'
end

local function linkup(text)
	return "[[Contionary:" .. text .. "#Siwa|" .. text .. "]]"
end

function tests:check_output(term, expected, noresp)
	return tests:equals(
		linkup(gsub(term,"·","")),
		m_IPA.crux(term),
		expected,
		{ display = IPA_style }
	)
end

function tests:test_example()
	local list = {
		{"kigįini", "ˈcʰijːini"},
		{"gedli", "ˈɟetɬi"},
		{"poaṡṡi", "ˈpʰɔɑɕːi"},
		{"katsa", "ˈkʰɑt͡sa"},
		{"dảdna", "ˈdæːʔt̚na"},
		{"dảnaka", "ˈdæːnɑɡa"},
		{"kęmes", "ˈcʰæmɛs"},
		{"pilra", "ˈpʰɪlra"},
		{"tygi", "ˈtʰyɟi"},
		{"ymni", "ˈœmnːi"},
		{"tsġiauga", "ˈt͡sxiɑuɣa"},
		{"huoibmui", "ˈhʊɔɪʔp̚mui"},
		{"mamma", "ˈmɑmːa"},
		{"hįůdįa", "ˈhjød͡ʑa"},
		{"tỏ", "ˈtʰʊː"},
		{"gįosin", "ˈɟɔsɪn"},
		{"gįegįi", "ˈd͡zejːi"},
		{"kika", "ˈcʰika"},
		{"tsepu", "ˈt͡sepu"},
		{"huhhi", "ˈhuhːi"},
		{"tůppů", "ˈtʰœʔpø"},
		{"sauṡpỉdna", "ˈsaʊɕpiːʔt̚na"},
		{"voakna", "ˈvɔaʔk̚ŋa"},
		{"toḥḥami", "ˈtʰɔʔːɑmi"},
		{"oddo", "ˈɔtːɔ"},
		{"niḍgi", "ˈnɪðɟi"},
		{"nedġi", "ˈnɛðxi"},
		{"Teltsġvi", "ˈtʰɛɬt͡sxwi"},
		{"uįo·kỏesġen", "ˌujɔˈk⁽ʰ⁾ʊːɛsxɛn"},
		{"hait", "ˈhaɪʔɪ"},
		{"siaun", "ˈsɪaʊn"}, --made-up word to test triphthongs in the form -C#
		{"vihi", "ˈviʔi"},
		{"keika", "ˈcʰeiɡa"},
		{"i·sallusi", "ˌiˈsɑlːusi"},
		{"ỉhhįõ", "ˈihːjɔ̃"},
		{"gam·ġoġuana", "gaˈmxɔxuɑna"},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
	}
	self:iterate(list, "check_output")
end

return tests