Misplaced Pages

Module:Wikt-lang/testcases: Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< Module:Wikt-lang Browse history interactively← Previous editNext edit →Content deleted Content added
Revision as of 03:47, 30 June 2018 editErutuon (talk | contribs)Autopatrolled, Extended confirmed users32,174 edits added iterate method to Module:UnitTests← Previous edit Revision as of 21:09, 10 February 2020 edit undoPppery (talk | contribs)Interface administrators, Administrators100,202 edits Not an example; not for Module:BananasNext edit →
Line 1: Line 1:
-- Example Unit tests for ]. Click talk page to run tests. -- Unit tests for ]. Click talk page to run tests.
local p = require 'Module:UnitTests' local p = require 'Module:UnitTests'
local m_Language = require 'Module:Language' local m_Language = require 'Module:Language'

Revision as of 21:09, 10 February 2020

This is the test cases page for the module Module:Wikt-lang. Results of the test cases.
-- Unit tests for ]. Click talk page to run tests.
local p = require 'Module:UnitTests'
local m_Language = require 'Module:Language'

local function tag(word, languageCode)
	return '<span lang="' .. languageCode .. '">' .. word .. '</span>'
end

local decompose = mw.ustring.toNFD
function p:check_makeEntryName(languageCode, word, expected)
	self:equals(
		tag(word, languageCode),
		decompose(m_Language.makeEntryName(word, languageCode)),
		decompose(expected),
		{ display = function (word) return tag(word, languageCode) end })
end

p = function (self)
	local examples = {
		{ "ar", "العَرَبِيَّة", "العربية" },
		{ "grc", "δημοκρᾰτῐ́ᾱ", "δημοκρατία" },
		{ "ha", "àzàhàr̃iyyā̀", "azahariyya" },
		{ "la", "coëō", "coeo" },
		{ "nci", "Quetzalcōātl", "Quetzalcoatl" },
		{ "ru", "ру́сский язы́к", "русский язык" },
		{ "sh", "ćá", "ća" }, -- fake word with c-acute and tonal acute; add a real word if you know one
	}
	
	self:iterate(examples, "check_makeEntryName")
end

return p
Category: