Jump to content

Module:User:Erutuon/syllables/sandbox/testcases

From Wiktionary, the free dictionary

Module error: No such module "syllables/sandbox/testcases".


local tests = require("Module:UnitTests")

local m_syllables = require("Module:syllables/sandbox")

local function tag(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end

function tests:check(example, expected)
	self:equals(
		tag(example),
		m_syllables.count(example),
		expected
	)
end

function tests:test()
	local examples = {
		{ "ðɛɹ", 1 },
		{ "ðɛɚ", 2 },
		{ "ðɛɚ̯", 1 },
	}
	
	tests:iterate(examples, "check")
end

return tests