Module:ISO 3166/testcases
| This is the test cases page for the module Module:ISO 3166. Results of the test cases. |
local p = {}
local arguments = {
{'Canada'},
{'United States'},
{'The United States of America'},
{'US'},
{'US', 'New York'},
{'USA', 'New York'},
{'US-New York'},
{'USA-New York'},
{'US-NY'},
{'USA-NY'},
{'United States', 'New York'},
{'United States', 'New York (State)'},
{'United States', '[[New York (State)]]'},
{'United States', '[[New York (State)|Test]]'},
{'Guinea-Bissau'},
{'Guinea-Bissau-L'},
{'Guinea-Bissau', 'L'},
{'United-States'},
{'United States-New-York'},
{'GuineaBissau'},
{'GuineaBissau-L'},
{'GuineaBissau', 'L'},
{'GB-ENG'},
{'GB-ENG-Greenwich'},
{'GB-ENG', 'Greenwich'},
{'Wales-Belfast'},
{'Northern Ireland-Belfast'},
{'UK-Stoke-on-Trent'},
{'GB-ENG-Stoke-on-Trent'},
{'UK', 'Stoke-on-Trent'},
{'UK', 'Stoke on Trent'},
{'[[United States|THE PLACE]]'},
{'[[File:Flag_of_Canada.svg|20px]]'},
{'{{flag|India}}'},
{'{{CAN}}'},
{[[C"A'NA‘DA(AAA)']]},
{'Canada-'},
{'-Canada-'},
{'-Canada'},
{'Taiwan, Province of China'},
{'Taiwan'},
{'Republic of China'},
{'Republic of China', isoname='yes'},
{'TW'},
{'TWN'},
{'158'},
{'20'},
{'{{PRC}}'},
{'[ [Canada ] ]'},
{'Áfghanistan'},
{'United States<ref name=A>{{cite web|url=http://www.example.com}}</ref>'},
{'United States<ref name="B" />'},
{'[[Russia]]', '[[Sakha Republic]]'},
{'CA', 'BC', lang='fr'},
{'Foo'},
{'Foo-Bar'},
{'Foo', 'Bar'},
{'USA-Foo'},
{'USA', 'Foo'}
}
local function stripOnly(params, special)
local code = (special == 'code' and '<td><code><nowiki>' or '<td>')
if params[1] then
code = code..(special == 'sandbox' and '{{#invoke:ISO 3166/sandbox' or '{{#invoke:ISO 3166')..'|strip'..'|'..params[1]..'}}'
end
if params[2] then
code = code..' '..(special == 'sandbox' and '{{#invoke:ISO 3166/sandbox' or '{{#invoke:ISO 3166')..'|strip'..'|'..params[2]..'}}'
end
return code..(special == 'code' and '</nowiki></code></td>' or '</td>')
end
local function makeCell(func, params, special)
if func == 'strip' then
return stripOnly(params, special)
end
local code = ''
code = code..(special == 'code' and '<td><code><nowiki>' or '<td>')..'{{'
code = code..(special == 'sandbox' and '#invoke:ISO 3166/sandbox' or '#invoke:ISO 3166')
code = code..'|'..func
for k,v in ipairs(params) do
code = code..'|'..v
end
for k,v in pairs(params) do
if type(k) ~= 'number' then
code = code..'|'..k..'='..v
end
end
code = code..'}}'..(special == 'code' and '</nowiki></code></td>' or '</td>')
return code
end
local function makeRow(frame, func, params)
local out = ''
out = out..makeCell(func, params) -- Live
out = out..makeCell(func, params, 'sandbox') -- Sandbox
out = out..makeCell(func, params, 'code') -- Code
return frame:preprocess('<tr>'..out..'</tr>')
end
function p.run(frame)
local out = '<tr><th>Live</th><th>Sandbox</th><th>Code</th></tr>'
for k,v in ipairs(arguments) do
out = out..makeRow(frame, frame.args[1], v)
end
return '<table class="wikitable">'..out..'</table>'
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.