وحدة:Altai-translit/testcases
المظهر
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