Module:fa-ira-translit/testcases: difference between revisions

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Content deleted Content added
No edit summary
No edit summary
Line 24: Line 24:
{ 'عَصاً', "’asan" },
{ 'عَصاً', "’asan" },
{ 'خانه', "xâne" },
{ 'خانه', "xâne" },
{ 'خانِه', "xâne" },
{ 'خانَه', "xâne" },
{ 'کُرِۀ شُمالی', "kore-ye šomâli" },
{ 'کُرِۀ شُمالی', "kore-ye šomâli" },
{ 'ضَمّه', "zamme" },
{ 'ضَمّه', "zamme" },

Revision as of 12:19, 12 June 2018

This is the unit testing module for Module:fa-ira-translit.

Lua error in package.lua at line 80: module 'Module:fa-translit' not found


-- Unit tests for [[Module:fa-translit]]. Refresh page to run tests.
local tests = require('Module:UnitTests')
local fa_translit = require('Module:fa-translit')
local m_links = require('Module:links')

local fa = require('Module:languages').getByCode('fa')
local function link(term)
	return m_links.full_link{term = term, lang = fa}
end

function tests:do_test_translit(Pers, roman, xlit)
	self:equals(link(Pers), fa_translit.tr(Pers, 'fa', 'fa-Arab'), roman)
end

function tests:test_translit_persian()
	local examples = {
		{ 'سَرانجام', "saranjâm" },
		{ 'سَرانْجام', "saranjâm" },
		{ 'سَرَانْجَام', "saranjâm" },
		{ 'کُروز', "koruz" },
		{ 'کُرَوز', "korawz" },
		{ 'طَنین', "tanin" },
		{ 'طَنَین', "tanayn" },
		{ 'عَصاً', "’asan" },
		{ 'خانه', "xâne" },
		{ 'خانَه', "xâne" },
		{ 'کُرِۀ شُمالی', "kore-ye šomâli" },
		{ 'ضَمّه', "zamme" },
		{ 'ضَمِّه', "zamme" },
		{ 'وُدکا', "vodkâ" },
		{ 'اَرمَنِستان', "armanestân" },
		{ 'باکو', "bâku" },
	}
	self:iterate(examples, "do_test_translit")
end	

return tests