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 luaModule = require('Module:ISO 3166')
local luaSandbox= require('Module:ISO 3166/sandbox')
local arguments = {
{'Canada'},
{'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]]'},
{'{{flag|India}}'},
{'{{CAN}}'},
{'[[Canada]]'},
{[[C"A'NA‘,DA(AAA)']]},
{'Taiwan, Province of China'},
{'Taiwan'},
{'Republic of China'},
{'TW'},
{'TWN'},
{'158'},
{'{{PRC}}'},
{'{{USA}}'},
{'United States<ref name=A>{{cite web|url=http://www.example.com}}</ref>'},
{'United States<ref name="A">{{cite web|url=http://www.example.com}}</ref>'},
{'United States<ref name="B" />'},
{'[[Russia]]', '[[Sakha Republic]]'}
}
function p.makeRow(frame, fu, pa)
local out = ''
local code = ''
if fu == 'callstrip' then
out = out..'<td>'..luaModule({pa[1]})..(pa[2] and ' '..luaModule({pa[2]}) or '')..'</td>'
out = out..'<td>'..luaSandbox({pa[1]})..(pa[2] and ' '..luaSandbox({pa[2]}) or '')..'</td>'
code = '<code><nowiki>|1 = '..pa[1]..'</nowiki></code><br />'
code = pa[2] and code..'<code><nowiki>|2 = '..pa[2]..'</nowiki></code>' or code
out = out..'<td>'..code..'</td>'
else
out = out..'<td>'..luaSandbox(pa)..'</td>'
out = out..'<td>'..luaSandbox(pa)..'</td>'
for k,v in pairs(pa) do
code = code..'<code><nowiki>|'..k..' = '..v..'</nowiki></code><br />'
end
out = out..'<td>'..code..'</td>'
end
return frame:preprocess('<tr>'..out..'</tr>')
end
function p.makeTable(frame, fu)
local out = '<tr><th>Live</th><th>Sandbox</th><th>Code</th></tr>'
for k,v in ipairs(arguments) do
out = out..p.makeRow(frame, fu, v)
end
return '<table class="wikitable">'..out..'</table>'
end
function p.run(frame)
return p.makeTable(frame, frame.args[1])
end
return p