Module:Adjacent stations/testcases
Appearance
![]() | This is the test cases page for the module Module:Adjacent stations. Results of the test cases. |
-- Unit tests for [[Module:Adjacent stations]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_01_icon()
self:preprocess_equals_sandbox_many('{{#invoke:Adjacent stations', 'icon', {
--{'Taipei|R', ''},
-- Icon for system with icon.
{'system=MTR', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]]'},
{'MTR', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]]'},
-- Icon for system without icon.
{'system=San Diego Trolley', ''},
{'San Diego Trolley', ''},
-- Icon for line with icon.
{'system=San Diego Trolley|line=Green', '[[File:San Diego Trolley Green Line.svg|16px]]'},
{'San Diego Trolley|Green', '[[File:San Diego Trolley Green Line.svg|16px]]'},
-- Icon for type with icon.
{'system=Taoyuan Metro|line=Airport|type=Commuter', '[[File:Taoyuan Metro Line Airport.svg|18px|link=Taoyuan Airport MRT]]'},
{'Taoyuan Metro|Airport|Commuter', '[[File:Taoyuan Metro Line Airport.svg|18px|link=Taoyuan Airport MRT]]'},
-- _default icon for lines.
{'Antwerp tram|1', '[[File:DeLijn icon 1antw.svg|16px|alt=]]'},
-- _default icon for lines using alias.
{'Antwerp tram|line 1', '[[File:DeLijn icon 1antw.svg|16px|alt=]]'},
-- Override _default icon for lines with icon specified.
{'São Paulo Metropolitan Trains|13-AE', '[[File:Cptm 13.svg|16px|alt=]]'},
-- Sole line default.
{'Taiwan High Speed Rail', '[[File:Taiwan High Speed Rail Logo(Log Only).svg|18px|link=Taiwan High Speed Rail|alt=Taiwan High Speed Rail]]'},
-- Override icon for line when "icon format" is set.
{'Brampton Transit|Brampton Transit', ''},
})
end
-- Need to create tests for:
--- ["system icon format"]
--- line_type['icon format']
--- data['type icon format']
--- data['line icon format']
-- inline
--- route without link
--- route with link
--- croute without link
--- croute with link
--- xroute without link
--- xroute with link
--- legend
function p:test_02_icon_icon_format()
self:preprocess_equals_sandbox_many('{{#invoke:Adjacent stations', 'icon', {
-- Icon for line with with "system icon format" = "route".
{'system=Brussels Metro|line=1', ''},
{'Brussels Metro|1', ''},
-- Icon for line with with "system icon format" = "croute".
{'system=Vorarlberg S-Bahn|line=1', ''},
{'Vorarlberg S-Bahn|1', ''},
-- Icon for line with "line icon format" = "link".
{'system=MTR|line=Island', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]]'},
{'MTR|Island', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]]'},
-- Icon for line with with "line icon format" = "link" using alias.
{'system=MTR|line=isl', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]]'},
{'MTR|isl', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]]'},
-- Icon for line with with "line icon format" = "route".
{'system=Shenzhen Metro|line=1', ''},
{'Shenzhen Metro|1', ''},
-- Icon for line with with "line icon format" = "croute".
{'system=MTR Light Rail|line=505', ''},
{'MTR Light Rail|505', ''},
-- Icon for line when "icon format" = "route" is set.
{'Brampton Transit|501 Züm Queen', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[501 Züm Queen|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">501</span>]]</span>'},
-- Icon for line with with "icon format" = "croute".
{'system=VR Group|line=Orivesi-Jyväskylä', ''},
{'VR Group|Orivesi-Jyväskylä', ''},
})
end
function p:test_03_icon_icon_with_name()
self:preprocess_equals_sandbox_many('{{#invoke:Adjacent stations', 'icon', {
-- Icon for system with icon and name.
{'system=MTR|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[MTR]]'},
{'MTR|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[MTR]]'},
-- Icon for system without icon and name.
{'system=San Diego Trolley|name=y', '[[San Diego Trolley]]'},
{'San Diego Trolley|name=y', '[[San Diego Trolley]]'},
-- Icon for line with icon format and name.
{'system=MTR|line=Island|name=y', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]] [[Island line (MTR)|Island line]]'},
{'MTR|Island|name=y', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]] [[Island line (MTR)|Island line]]'},
-- Icon for line with icon format and name using alias.
{'system=MTR|line=isl|name=y', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]] [[Island line (MTR)|Island line]]'},
{'MTR|isl|name=y', '[[Island line (MTR)|<span style="background-color:#007dc5;border:1px solid #000"> </span>]] [[Island line (MTR)|Island line]]'},
-- Icon for line with icon and name.
{'system=San Diego Trolley|line=Green|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[Green Line (San Diego Trolley)|Green Line]]'},
{'San Diego Trolley|Green|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[Green Line (San Diego Trolley)|Green Line]]'},
-- Icon for type with icon and name.
{'system=Taoyuan Metro|line=Airport|type=Commuter|name=y', '[[File:Taoyuan Metro Line Airport.svg|18px|link=Taoyuan Airport MRT]] [[Taoyuan Airport MRT]]'},
{'Taoyuan Metro|Airport|Commuter|name=y', '[[File:Taoyuan Metro Line Airport.svg|18px|link=Taoyuan Airport MRT]] [[Taoyuan Airport MRT]]'},
})
end
return p