Module:ISO 3166/testcases
Appearance
![]() | This is the test cases page for the module Module:ISO 3166. Results of the test cases. |
--SEE: Module talk:ISO 3166/testcases
local p = {}
local arguments = {
{'United States'},
{'The United States of America'},
{'US'},
{'US', 'New York'},
{'USA', 'New York'},
{'US-NY'},
{'United States', 'New York'},
{'United States', 'New York (State)'},
{'United States', '[[New York (State)]]'},
{'United States', '[[New York (State)|Test]]'},
{'Áfghanistan'},
{'[[United States|THE PLACE]]'},
{'[[File:Flag of Canada.svg|20px]]'},
{'[[File:Flag_of_Canada.svg|20px]]'},
{'{{flag|India}}'},
{'{{CAN}}'},
{'[[Canada]]'},
{[[C"A'NA‘,DA(AAA)']]},
{'Taiwan, Province of China'},
{'Taiwan'},
{'Republic of China'},
{'TW'},
{'TWN'},
{'158'},
{'{{PRC}}'},
{'{{USA}}'}
}
function p.makeCell(fu, pa)
if fu == 'callstript' then
return '<td>'..'{{#invoke:ISO 3166|'..fu..'|'..pa[1]..'}}'..(pa[2] and '{{#invoke:ISO 3166|'..fu..'|'..pa[2]..'}}' or '')..'</td>'
else
return '<td>'..'{{#invoke:ISO 3166|'..fu..'|'..pa[1]..(pa[2] and '|'..pa[2] or '')..'}}'..'</td>'
end
end
function p.makeRow(frame, fu, pa)
local out = frame:preprocess(p.makeCell(fu, pa)) -- Normal
out = out..frame:preprocess(p.makeCell(fu, pa):gsub('ISO 3166','ISO 3166/sandbox')) -- Sandbox
out = out..p.makeCell(fu, pa) -- Code
return '<tr>'..out..'</tr>'
end
function p.makeTable(frame, fu)
local out = ''
for k,v in ipairs(arguments) do
out = out..p.makeRow(frame, fu, v)
end
return '<table>'..out..'</table>'
end
function p.run(frame)
return p.makeTable(frame, frame.args[1])
end
return p