Module:User:AmazingJus/so/testcases

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

This is a private module sandbox of AmazingJus, for his own experimentation. Items in this module may be added and removed at AmazingJus's discretion; do not rely on this module's stability.


local tests = require('Module:UnitTests')
local m_IPA = require('Module:User:AmazingJus/so')

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

function tests:check_output(term, expected, link)
	return tests:equals(
		link and m_IPA.link(term) .. " (respelled " .. m_IPA.tag_text(link) .. ")" or m_IPA.link(term),
		m_IPA.toIPA(term),
		expected,
		{ display = tag_IPA }
	)
end

function tests:test_pron()
	local list = {
		{"inán<F>", "inǽn" },
		{"ínan<F>", "ínæn" },
		{"geedka", "FIXME" }
	}
	self:iterate(list, "check_output")
end

--[[
			Additions take this form –
		{ "entry name", "IPA" },
		{ "", "" },
			or, if you are generating IPA from a respelling of the term –
		{ "respelling", "IPA", "entry name" }
		{ "", "", "" },
			Make sure to include the comma, or the module will return an error.
]]--

return tests