Module:qay-pron/testcases

< Module:qay-pron
Revision as of 12:19, 24 June 2022 by Sware (talk | contribs) (Created page with "local tests = require('Module:UnitTests') local m_IPA = require('Module:qay-pron') local function IPA_style(IPA) return '<span style="font-size:110%;font-family:Gentium,\'De...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

2 tests failed. (refresh)
Text Expected Actual
test_phonemic:
Script error during testing: Module:qay-pron/testcases:15: attempt to call field 'phonemic' (a nil value)
stack traceback:
	Module:qay-pron/testcases:15: in function 'func'
	Module:UnitTests:247: in function 'iterate'
	Module:qay-pron/testcases:57: in function <Module:qay-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]: ?
Text Expected Actual
test_phonetic:
Script error during testing: Module:qay-pron/testcases:24: attempt to call field 'phonetic' (a nil value)
stack traceback:
	Module:qay-pron/testcases:24: in function 'func'
	Module:UnitTests:247: in function 'iterate'
	Module:qay-pron/testcases:87: in function <Module:qay-pron/testcases:60>
	(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:qay-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 link(term)
	return '[[Contionary:' .. term .. "#Ayeri|" .. term	.. ']]'
end

function tests:check_phonemic(term, expected)
	return tests:equals(
		link(term),
		m_IPA.phonemic(term),
		expected,
		{ display = IPA_style, show_difference = true}
	)
end

function tests:check_phonetic(term, expected)
	return tests:equals(
		link(term),
		m_IPA.phonetic(term),
		expected,
		{ display = IPA_style, show_difference = true}
	)
end

function tests:test_phonemic()
	local list = {
		{"ankyu", ""},
		{"netujas", ""},
		{"nivajya", ""},
		{"maviyēri", ""},
		{"tahi", ""},
		{"baho", ""},
		{"tavvāng", ""},
		{"disyyang", ""},
		{"tipuyya", ""},
		{"ming", ""},
		{"enya", ""},
		{"agon", ""},
		{"pakur", ""},
		{"mine", ""},
		{"huākaya", ""},
		{"adauyi", ""},
		{"edauyi", ""},
		{"nekuyi", ""},
		{"minguay", ""},
		{"linktang", ""},
		{"silvnang", ""},
		{"migryo", ""},
		{"subrjo", ""},
		{"ay", ""},
	}
	self:iterate(list, "check_phonemic")
end

function tests:test_phonetic()
	local list = {
		{"ankyu", ""},
		{"netujas", ""},
		{"nivajya", ""},
		{"maviyēri", ""},
		{"tahi", ""},
		{"baho", ""},
		{"tavvāng", ""},
		{"disyyang", ""},
		{"tipuyya", ""},
		{"ming", ""},
		{"enya", ""},
		{"agon", ""},
		{"pakur", ""},
		{"mine", ""},
		{"huākaya", ""},
		{"adauyi", ""},
		{"edauyi", ""},
		{"nekuyi", ""},
		{"minguay", ""},
		{"linktang", ""},
		{"silvnang", ""},
		{"migryo", ""},
		{"subrjo", ""},
		{"ay", ""},
	}
	self:iterate(list, "check_phonetic")
end

return tests