Module:qhv-pron/testcases

< Module:qhv-pron
Revision as of 21:35, 7 February 2021 by Sware (talk | contribs)

2 tests failed. (refresh)
Text Expected Actual
test_antique:
Script error during testing: Module:qhv-pron/testcases:9: attempt to concatenate local 'noresp' (a nil value)
stack traceback:
	Module:qhv-pron/testcases:9: in function 'linkup'
	Module:qhv-pron/testcases:23: in function 'func'
	Module:UnitTests:247: in function 'iterate'
	Module:qhv-pron/testcases:59: in function <Module:qhv-pron/testcases:48>
	(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]: ?
Text Expected Actual
test_modern:
Script error during testing: Module:qhv-pron/testcases:9: attempt to concatenate local 'noresp' (a nil value)
stack traceback:
	Module:qhv-pron/testcases:9: in function 'linkup'
	Module:qhv-pron/testcases:14: in function 'func'
	Module:UnitTests:247: in function 'iterate'
	Module:qhv-pron/testcases:45: in function <Module:qhv-pron/testcases:30>
	(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:qhv-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, noresp)
	return "[[Contionary:" .. noresp or text .. "#High Valyrian|" .. text .. "]]"
end

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

function tests:check_output2(term, expected)
	return tests:equals(
		linkup(term),
		m_IPA.antique_crux(term),
		expected,
		{ display = IPA_style }
	)
end

function tests:test_modern()
	local list = {
		{"drakarys", "draˈkaɾys"},
		{"valonqar", "vaˈloɴqar"},
		{"Thoros", "ˈθoɾos"},
		{"arákh", "aˈɾax", "arakh"},
		{"ēngos", "ˈeːŋɡos"},
		{"amīvindigon", "amiːˈvindiɡon"},
		{"ojehiknon", "ojeˈhiknon"},
		{"pōja", "ˈpoːja"},
		{"riña", "ˈriɲa"},
		{"zirȳla", "ziˈɾyːla"},
		{"ipradis", "iˈpradis"},
		{"rholagon", "ṛoˈlaɡon"},
	}
	self:iterate(list, "check_output")
end

function tests:test_antique()
	local list = {
		{"vējōñe", "veːˈjoːɲe"},
		{"vōljes", "ˈwoːʎes"},
		{"vumbiarzy", "wumˈbi͜arzy"},
		{"vȳs", "ˈɥyːs"},
		{"ȳgha", "ˈyːɣa"},
		{"vajie", "ˈɥaɟi͜e"},
		{"vūjigon", "ˈwuːɟiɡon"},
		{"qrillaodikio", "qrilˈlao̯diki͜o"},
	}
	self:iterate(list, "check_output2")
end

return tests