From Wikipedia, the free encyclopedia

local p = require('Module:UnitTests')



local lang_data =  mw.loadData ('Module:Lang/data');							-- language name override and transliteration tool-tip tables

local lang_table = lang_data.lang_name_table.lang;

local override_table = lang_data.override;



local code_mask = '^[a-h]%l%l';													-- used to limit number of tests





--[[--------------------------< T E S T _ P A T T E R N S _ G E T >--------------------------------------------



build a table of test patterns where each entry in the table is a table with two members:

	{"<name>", "<tag>"}



]]



local function test_patterns_get ()

	local tpats = {}															-- collect test patterns here

	for tag, names in pairs (lang_table) do

		local pattern = {};														-- here we assemble the test pattern for <name>

--		if 2 == tag:len() then													-- no limits for two-character codes

		if tag:find (code_mask) then											-- if tag within limits (three-character codes)

			if override_tabletag then

				table.insert (pattern, override_tabletag][1]);					-- add first <name> only to the pattern

				table.insert (pattern, tag);									-- add the 'expected result' <tag>

			else

				table.insert (pattern, names1]);								-- add first <name> only to the pattern

				table.insert (pattern, tag);									-- add the 'expected result' <tag>

			end

			table.insert (tpats, pattern);										-- accumulate in list of patterns

		end

	end



	local function comp (a, b)													-- local function used by table.sort()

		return a2 < b2];														-- ascending sort by code (because test limits are by code)

	end

	

	table.sort (tpats, comp);													-- make the list pretty

	return tpats;																-- and done

end



local test_patterns = test_patterns_get();





--[[--------------------------< T E S T _ T A G _ F R O M _ N A M E >------------------------------------------

]]



function p:test_tag_from_name_iso_639_3_1()

	self:preprocess_equals_preprocess_many('{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', test_patterns, {nowiki=1})

end;



return p
From Wikipedia, the free encyclopedia

local p = require('Module:UnitTests')



local lang_data =  mw.loadData ('Module:Lang/data');							-- language name override and transliteration tool-tip tables

local lang_table = lang_data.lang_name_table.lang;

local override_table = lang_data.override;



local code_mask = '^[a-h]%l%l';													-- used to limit number of tests





--[[--------------------------< T E S T _ P A T T E R N S _ G E T >--------------------------------------------



build a table of test patterns where each entry in the table is a table with two members:

	{"<name>", "<tag>"}



]]



local function test_patterns_get ()

	local tpats = {}															-- collect test patterns here

	for tag, names in pairs (lang_table) do

		local pattern = {};														-- here we assemble the test pattern for <name>

--		if 2 == tag:len() then													-- no limits for two-character codes

		if tag:find (code_mask) then											-- if tag within limits (three-character codes)

			if override_tabletag then

				table.insert (pattern, override_tabletag][1]);					-- add first <name> only to the pattern

				table.insert (pattern, tag);									-- add the 'expected result' <tag>

			else

				table.insert (pattern, names1]);								-- add first <name> only to the pattern

				table.insert (pattern, tag);									-- add the 'expected result' <tag>

			end

			table.insert (tpats, pattern);										-- accumulate in list of patterns

		end

	end



	local function comp (a, b)													-- local function used by table.sort()

		return a2 < b2];														-- ascending sort by code (because test limits are by code)

	end

	

	table.sort (tpats, comp);													-- make the list pretty

	return tpats;																-- and done

end



local test_patterns = test_patterns_get();





--[[--------------------------< T E S T _ T A G _ F R O M _ N A M E >------------------------------------------

]]



function p:test_tag_from_name_iso_639_3_1()

	self:preprocess_equals_preprocess_many('{{#invoke:Lang/sandbox|tag_from_name|', '}}', '', '', test_patterns, {nowiki=1})

end;



return p

Videos

Youtube | Vimeo | Bing

Websites

Google | Yahoo | Bing

Encyclopedia

Google | Yahoo | Bing

Facebook