Module:User:Benwing2/es-verb/testcases

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

1 of 1 test failed. (refresh)

TextExpectedActual
test:
Passed<ue>; lemma=contarcontar<ue>contar<ue>
Script error during testing: Module:User:Benwing2/es-verb:2253: Unrecognized infinitive: decir la verdad
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:User:Benwing2/es-verb:2253: in function 'detect_indicator_spec'
	Module:User:Benwing2/es-verb:2328: in function 'fun'
	Module:inflection_utilities:1126: in function 'map_word_specs'
	Module:User:Benwing2/es-verb:2326: in function 'detect_all_indicator_specs'
	Module:User:Benwing2/es-verb:3129: in function 'do_generate_forms'
	Module:User:Benwing2/es-verb/testcases:30: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:User:Benwing2/es-verb/testcases:41: in function <Module:User:Benwing2/es-verb/testcases:40>
	(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:864: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tests = require("Module:UnitTests")
local m_es_verb = require("Module:User:Benwing2/es-verb")
local m_links = require("Module:links")
local lang = require("Module:languages").getByCode("es")

local rsplit = mw.text.split
local rmatch = mw.ustring.match

local function display_raw_code(code)
	local nowiki_code = mw.getCurrentFrame():callParserFunction("#tag:nowiki", code)
	return "<code>" .. nowiki_code .. "</code>"
end

local function link(text)
	return m_links.full_link{ term = text, lang = lang }
end

local reconstruct_verb_spec_examples = {
	{"<ue>", "contar", "contar<ue>"},
	{"", "decir la verdad", "decir<> la verdad"},
	{"((<>,<ue>))", "colar", "((colar<>,colar<ue>))"},
	{"((colar<>,colar<ue>)) el cuello", "colar el cuello", "((colar<>,colar<ue>)) el cuello"},
	{"((colar<>,colar<ue>)) [[el]] [[colo|cuello]]", "colar el cuello", "((colar<>,colar<ue>)) [[el]] [[colo|cuello]]"},
	{"amar", "amar", "amar"},
}

local options = { display = display_raw_code }

function tests:check_reconstruct_verb_spec(orig_spec, lemma, expected_reconstructed_spec)
	local alternant_multiword_spec = m_es_verb.do_generate_forms({[1] = orig_spec, pagename = lemma})
	local actual_reconstructed = m_es_verb.reconstruct_verb_spec(alternant_multiword_spec)
	self:equals(
		display_raw_code(orig_spec) .. "; lemma=" .. link(lemma),
		actual_reconstructed,
		expected_reconstructed_spec,
		options
	)
end

function tests:test()
	self:iterate(reconstruct_verb_spec_examples, "check_reconstruct_verb_spec")
end

return tests