Module:User:Benwing2/es-verb/testcases

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 " " end

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

local reconstruct_verb_spec_examples = { {"", "contar", "contar"}, {"", "decir la verdad", "decir<> la verdad"}, {"((<>,))", "colar", "((colar<>,colar))"}, {"((colar<>,colar)) el cuello", "colar el cuello", "((colar<>,colar)) el cuello"}, {"((colar<>,colar)) el cuello", "colar el cuello", "((colar<>,colar)) el 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