Module:ka-infl-noun/testcases

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

This is the unit-testing module for Module:ka-infl-noun.

1 of 0 tests failed. (refresh)

TextExpectedActualDiffers at
tests_main:
Script error during testing: Module:ka-infl-noun/testcases:40: attempt to call field 'test' (a nil value)
stack traceback:
	[C]: in function 'test'
	Module:ka-infl-noun/testcases:40: in function <Module:ka-infl-noun/testcases:5>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:856: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tester = require('Module:UnitTests') -- [[Module:UnitTests]]
local mod = require('Module:ka-infl-noun') -- [[Module:ka-infl-noun]]
-- also see [[User:Dixtosa/ka-infl-noun/test]]

function tester:tests_main()
	local testcases = {
		["კაცი"] = {tests = {{"nom2", "კაცები"}}},
		
		["ტრამვაი"] = {args = {[1] = "", [2] = "noarchaic"}, 
					  tests = {{"gen1", "ტრამვაის(ა)"}, {"dat2", "ტრამვაებს(ა)"}, {"voc3", ""}}},
		
		["ამბავი"] = {args = {[1] = "ამბ"}, 
					tests = {{"voc3", "ამბავნო"}, {"ins1", "ამბით(ა)"}}},
		
		["ანა"] = {args = {[1] = "given name"}, 
					tests = {{"gen1", "ანას"}}}, --ანას(ი)?
		
		["გიორგი"] = {args = {[1] = "გიორგი", [2] = "given name"}, 
					tests = {{"adv1", "გიორგიდ"}, {"dat1", "გიორგის"}}},
					
		["დავითი"] = {args = {[1] = "given name"}, 
					tests = {{"adv1", "დავითად"}, {"dat1", "დავითს"}}},
					
		["ქვეყანა"] = {args = {[1] = "ქვეყნ"},
					tests = {{"gen1", "ქვეყნის(ა)"}}},
					
		["დედა"] = {args = {voc1 = "+, [[დედა]] or [[დე]]"}, 
					tests = {{"voc1", "დედავ, დედა or დე"}}}
	}
	
	for inflTerm, testcase in pairs(testcases) do
		local tests = testcase["tests"];
		local term = testcase["term"] or inflTerm;
		local args = testcase["args"] or {}
		args["term"] = term
		
		for _, test in pairs(tests) do
			local form, shouldbe = unpack(test)
			local testname = form .. ". of " .. term
			self:equals(testname, mod.test(args, form), shouldbe, {nowiki = true})
		end
	end
end

return tester