Module:ábḫ-ipa/remake/testcases: Difference between revisions

From Linguifex
Jump to navigation Jump to search
(Created page with "local tests = require('Module:UnitTests') local m_IPA = require('Module:ábḫ-ipa/remake') local function IPA_style(IPA) return '<span style="font-size:110%;font-family:Gen...")
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 13: Line 13:
return tests:equals(
return tests:equals(
linkup(term),
linkup(term),
m_IPA.crux(term),
m_IPA.show(term),
expected,
expected,
{ display = IPA_style }
{ display = IPA_style }
Line 21: Line 21:
function tests:test_example()
function tests:test_example()
local list = {
local list = {
{"zaḫáza", "θ̱ɐˈxá.θ̱ɐ"},
{"zaḫáza", "θ̱ɐˈxä˦.θ̱ɐ"},
{"áken", "ˈä˦.kɛn̪"},
{"áken", "ˈä˦.kɛn̪"},
--[[{"", ""},
--[[{"", ""},

Latest revision as of 14:26, 10 April 2021

2 tests failed. (refresh)

Text Expected Actual
test_example:
Failed zaḫáza θ̱ɐˈxä˦.θ̱ɐ θä-xä˦-θä
Failed áken ˈä˦.kɛn̪ ä˦-ken

local tests = require('Module:UnitTests')
local m_IPA = require('Module:ábḫ-ipa/remake')

local function IPA_style(IPA)
	return '<span style="font-size:110%;font-family:Gentium,\'DejaVu Sans\',\'Segoe UI\',sans-serif>' .. IPA .. '</span>'
end

local function linkup(text)
	return "[[Contionary:" .. text .. "#Ábḫanni|" .. text .. "]]"
end

function tests:check_output(term, expected, noresp)
	return tests:equals(
		linkup(term),
		m_IPA.show(term),
		expected,
		{ display = IPA_style }
	)
end

function tests:test_example()
	local list = {
		{"zaḫáza", "θ̱ɐˈxä˦.θ̱ɐ"},
		{"áken", "ˈä˦.kɛn̪"},
		--[[{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},
		{"", ""},]]
	}
	self:iterate(list, "check_output")
end

return tests