Jump to content

Module:Altai-translit/testcases

From Wiktionary, the free dictionary

4 of 5 tests failed. (refresh)

TextExpectedActualDiffers at
test_translit:
Passedкöндӱрeköndüreköndüre
Failedмындаmındamïnda2
Failedкичӱkïčükičü2
Failedтартыжарtartıžartartïžar5
Failedсегизинчиsägïzïnčïsegizinči2

local tests = require("Module:UnitTests")
local transliterate = require("Module:Altai-translit").tr
local normalize = mw.ustring.toNFC
local gsub = string.gsub

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

local function remove_categories(text)
	return gsub(text, "%[%[Category:[^%]]+%]%]", "")
end

function tests:check(example, expected)
	self:equals(
		tag(example),
		remove_categories(normalize(transliterate(example))),
		normalize(expected),
		{ show_difference = true }
	)
end

function tests:test_translit()
	local examples = {
		{ "кöндӱрe", "köndüre" },
		{ "мында", "mında" },	
		{ "кичӱ", "kïčü" },
		{ "тартыжар", "tartıžar" },
		{ "сегизинчи", "sägïzïnčï" },
	}
	
	tests:iterate(examples, "check")
end

return tests