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', {
-- 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=testcases/Test module|line=line with title', '[[File:San Diego Trolley Green Line.svg|16px]]'},
{'testcases/Test module|line with title', '[[File:San Diego Trolley Green Line.svg|16px]]'},
-- Icon for type without icon - use line icon.
{'system=testcases/Test module|line=line with type|type=type with title', '[[File:Taoyuan Metro Line Airport.svg|18px|link=Taoyuan Airport MRT]]'},
{'testcases/Test module|line with type|type with title', '[[File:Taoyuan Metro Line Airport.svg|18px|link=Taoyuan Airport MRT]]'},
-- Icon for type with icon.
{'system=testcases/Test module|line=line with type|type=icon type', '[[File:San Diego Trolley Blue Line.svg|16px]]'},
{'testcases/Test module|line with type|icon type', '[[File:San Diego Trolley Blue Line.svg|16px]]'},
-- _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_format()
self:preprocess_equals_sandbox_many('{{#invoke:Adjacent stations', 'icon', {
-- Icon for line with with "system icon format" = "route".
{'system=Brussels Metro|line=1', '<span style="background-color:#B95192;border:.075em solid #B95192;padding:0 .3em">[[Brussels Metro line 1|<span style="color:#000000;font-weight:bold;font-size:inherit;white-space:nowrap">1</span>]]</span>',},
{'Brussels Metro|1', '<span style="background-color:#B95192;border:.075em solid #B95192;padding:0 .3em">[[Brussels Metro line 1|<span style="color:#000000;font-weight:bold;font-size:inherit;white-space:nowrap">1</span>]]</span>',},
-- Icon for line with with "system icon format" = "croute".
{'system=Vorarlberg S-Bahn|line=1', '<span style="background-color:#DC0530;border:.075em solid #DC0530;border-radius:.5em;padding:0 .3em">[[Vorarlberg S-Bahn#Lines|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">S1</span>]]</span>'},
{'Vorarlberg S-Bahn|1', '<span style="background-color:#DC0530;border:.075em solid #DC0530;border-radius:.5em;padding:0 .3em">[[Vorarlberg S-Bahn#Lines|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">S1</span>]]</span>'},
-- 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', '<span style="background-color:#00ab39;border:.075em solid #00ab39;padding:0 .3em">[[Line 1 (Shenzhen Metro)|<span style="color:#000000;font-weight:bold;font-size:inherit;white-space:nowrap">1</span>]]</span>'},
{'Shenzhen Metro|1', '<span style="background-color:#00ab39;border:.075em solid #00ab39;padding:0 .3em">[[Line 1 (Shenzhen Metro)|<span style="color:#000000;font-weight:bold;font-size:inherit;white-space:nowrap">1</span>]]</span>'},
-- Icon for line with with "line icon format" = "croute".
{'system=MTR Light Rail|line=505', '<span style="background-color:#FF0000;border:.075em solid #FF0000;border-radius:.5em;padding:0 .3em">[[MTR Light Rail Route 505|<span style="color:#000000;font-weight:bold;font-size:inherit;white-space:nowrap">505</span>]]</span>'},
{'MTR Light Rail|505', '<span style="background-color:#FF0000;border:.075em solid #FF0000;border-radius:.5em;padding:0 .3em">[[MTR Light Rail Route 505|<span style="color:#000000;font-weight:bold;font-size:inherit;white-space:nowrap">505</span>]]</span>'},
--[[
Tests for lines and types.
]]--
-- Icon for line with with "icon format" = "link".
{'system=testcases/Test module|line=link line', '[[501 Züm Queen|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
{'testcases/Test module|link line', '[[501 Züm Queen|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
-- Icon for line when "icon format" = "route".
{'system=testcases/Test module|line=route line', '<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">route line</span>]]</span>'},
{'testcases/Test module|route line', '<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">route line</span>]]</span>'},
-- Icon for line with with "icon format" = "croute".
{'system=testcases/Test module|line=croute line', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute line</span>]]</span>'},
{'testcases/Test module|croute line', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute line</span>]]</span>'},
-- Icon for line with with "icon format" = "xroute".
{'system=testcases/Test module|line=xroute line', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute line</span>]]</span>'},
{'testcases/Test module|xroute line', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute line</span>]]</span>'},
-- Icon for line with with "icon format" = "legend".
{'system=testcases/Test module|line=legend line', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[501 Züm Queen]]</div>'},
{'testcases/Test module|legend line', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[501 Züm Queen]]</div>'},
-- Icon for type with with "icon format" = "link".
{'system=testcases/Test module|line=line with type|type=link type', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
{'testcases/Test module|line with type|link type', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
-- Icon for type when "icon format" = "route".
{'system=testcases/Test module|line=line with type|type=route type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
{'testcases/Test module|line with type|route type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
-- Icon for type with with "icon format" = "croute".
{'system=testcases/Test module|line=line with type|type=croute type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
{'testcases/Test module|line with type|croute type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
-- Icon for type with with "icon format" = "xroute".
{'system=testcases/Test module|line=line with type|type=xroute type', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
{'testcases/Test module|line with type|xroute type', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
-- Icon for type with with "icon format" = "legend".
{'system=testcases/Test module|line=line with type|type=legend type', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – legend title</div>'},
{'testcases/Test module|line with type|legend type', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – legend title</div>'},
--[[
Tests for the use of short names in lines and types.
]]--
-- Icon for line with with "icon format" = "link" and short name.
{'system=testcases/Test module|line=link line short name', '[[501 Züm Queen|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
{'testcases/Test module|link line short name', '[[501 Züm Queen|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
-- Icon for line when "icon format" = "route" and short name.
{'system=testcases/Test module|line=route line short name', '<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">route line</span>]]</span>'},
{'testcases/Test module|route line short name', '<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">route line</span>]]</span>'},
-- Icon for line with with "icon format" = "croute" and short name.
{'system=testcases/Test module|line=croute line short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute line</span>]]</span>'},
{'testcases/Test module|croute line short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute line</span>]]</span>'},
-- Icon for line with with "icon format" = "xroute" and short name.
{'system=testcases/Test module|line=xroute line short name', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute line</span>]]</span>'},
{'testcases/Test module|xroute line short name', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[501 Züm Queen|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute line</span>]]</span>'},
-- Icon for line with with "icon format" = "legend" and short name.
{'system=testcases/Test module|line=legend line short name', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[501 Züm Queen]]</div>'},
{'testcases/Test module|legend line short name', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[501 Züm Queen]]</div>'},
-- Icon for type with with "icon format" = "link" and short name.
{'system=testcases/Test module|line=line with type|type=link type short name', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
{'testcases/Test module|line with type|link type short name', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
-- Icon for type when "icon format" = "route" and short name.
{'system=testcases/Test module|line=line with type|type=route type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
{'testcases/Test module|line with type|route type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
-- Icon for type with with "icon format" = "croute" and short name.
{'system=testcases/Test module|line=line with type|type=croute type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
{'testcases/Test module|line with type|croute type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
-- Icon for type with with "icon format" = "xroute" and short name.
{'system=testcases/Test module|line=line with type|type=xroute type short name', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
{'testcases/Test module|line with type|xroute type short name', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
-- Icon for type with with "icon format" = "legend" and short name.
{'system=testcases/Test module|line=line with type|type=legend type short name', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – [[501 Züm Queen]]</div>'},
{'testcases/Test module|line with type|legend type short name', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – [[501 Züm Queen]]</div>'},
})
end
function p:test_04_errors_maybe()
self:preprocess_equals_sandbox_many('{{#invoke:Adjacent stations', 'icon', {
--[[
Tests for a type of a line without a title.
]]--
-- Icon for type with with "icon format" = "link".
{'system=testcases/Test module|line=line without title with type|type=link type', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
{'testcases/Test module|line without title with type|link type', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
-- Icon for type when "icon format" = "route".
{'system=testcases/Test module|line=line without title with type|type=route type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
{'testcases/Test module|line without title with type|route type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
-- Icon for type with with "icon format" = "croute".
{'system=testcases/Test module|line=line without title with type|type=croute type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
{'testcases/Test module|line without title with type|croute type', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
-- Icon for type with with "icon format" = "xroute".
{'system=testcases/Test module|line=line without title with type|type=xroute type', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
{'testcases/Test module|line without title with type|xroute type', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
-- Icon for type with with "icon format" = "legend".
{'system=testcases/Test module|line=line without title with type|type=legend type', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – legend title</div>'},
{'testcases/Test module|line without title with type|legend type', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – legend title</div>'},
-- Icon for type with with "icon format" = "link" and short name.
{'system=testcases/Test module|line=line without title with type|type=link type short name', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
{'testcases/Test module|line without title with type|link type short name', '[[Taoyuan Airport MRT|<span style="background-color:#ff0000;border:1px solid #000"> </span>]]'},
-- Icon for type when "icon format" = "route" and short name.
{'system=testcases/Test module|line=line without title with type|type=route type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
{'testcases/Test module|line without title with type|route type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">route type</span>]]</span>'},
-- Icon for type with with "icon format" = "croute" and short name.
{'system=testcases/Test module|line=line without title with type|type=croute type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
{'testcases/Test module|line without title with type|croute type short name', '<span style="background-color:#ff0000;border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#FFFFFF;font-weight:bold;font-size:inherit;white-space:nowrap">croute type</span>]]</span>'},
-- Icon for type with with "icon format" = "xroute" and short name.
{'system=testcases/Test module|line=line without title with type|type=xroute type short name', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
{'testcases/Test module|line without title with type|xroute type short name', '<span style="border:.075em solid #ff0000;border-radius:.5em;padding:0 .3em">[[Taoyuan Airport MRT|<span style="color:#ff0000;font-weight:bold;font-size:inherit;white-space:nowrap">xroute type</span>]]</span>'},
-- Icon for type with with "icon format" = "legend" and short name.
{'system=testcases/Test module|line=line without title with type|type=legend type short name', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – [[501 Züm Queen]]</div>'},
{'testcases/Test module|line without title with type|legend type short name', '<div class="legend" style="page-break-inside:avoid;break-inside:avoid-column"><span class="legend-color" style="display:inline-block;width:1.5em;height:1.5em;margin:1px 0;border:1px solid black;background-color:#ff0000"> </span> [[Taoyuan Airport MRT]] – [[501 Züm Queen]]</div>'},
})
end
function p:test_03_icon_with_name()
self:preprocess_equals_sandbox_many('{{#invoke:Adjacent stations', 'icon', {
-- Icon for system with icon and name.
{'system=testcases/Test module|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[VR Group]]'},
{'testcases/Test module|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[VR Group]]'},
-- 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=testcases/Test module|line=line with title|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[Green Line (San Diego Trolley)|Green Line]]'},
{'testcases/Test module|line with title|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=testcases/Test module|line=line with type|type=type with title|name=y', ''},
{'testcases/Test module|line with type|type with title|name=y', ''},
--[[
Tests for lines without titles.
]]--
-- Icon and name for line without title. Use system title.
{'system=testcases/Test module|line=line without title|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[VR Group]]'},
{'testcases/Test module|line without title|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[VR Group]]'},
-- Icon and name for line with linked title and short name. Pipe short name.
{'system=testcases/Test module|line=line with linked title and shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[Green Line (San Diego Trolley)|linked short name]]'},
{'testcases/Test module|line with linked title and shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[Green Line (San Diego Trolley)|linked short name]]'},
-- Icon and name for line with unlinked title and short name. Use short name.
{'system=testcases/Test module|line=line with unlinked title and shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] unlinked short name'},
{'testcases/Test module|line with unlinked title and shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] unlinked short name'},
-- Icon and name for line without title and with short name. Use short name.
{'system=testcases/Test module|line=line without title and with shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] short name'},
{'testcases/Test module|line without title and with shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] short name'},
--[[
Tests for lines without icons and title variations.
]]--
-- Icon for line without icon and with title.
{'system=testcases/Test module|line=line without icon and with title|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[Green Line (San Diego Trolley)|Green Line]]'},
{'testcases/Test module|line without icon and with title|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[Green Line (San Diego Trolley)|Green Line]]'},
-- Icon for line without icon and with title and short name.
{'system=testcases/Test module|line=line without icon and with title and shortname|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[Green Line (San Diego Trolley)|short name]]'},
{'testcases/Test module|line without icon and with title and shortname|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] [[Green Line (San Diego Trolley)|short name]]'},
-- Icon for line without icon and title and with short name.
{'system=testcases/Test module|line=line without icon and title and with shortname|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] short name'},
{'testcases/Test module|line without icon and title and with shortname|name=y', '[[File:HK MTR logo (PD).svg|x14px|link=MTR|alt=MTR]] short name'},
-- Icon for line without icon, title and short name.
{'system=testcases/Test module|line=line without icon title and shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[VR Group]]'},
{'testcases/Test module|line without icon title and shortname|name=y', '[[File:San Diego Trolley Green Line.svg|16px]] [[VR Group]]'},
--[[
Tests for a type without a title.
]]--
{'system=testcases/Test module|line=line with type|type=type without title|name=y', ''},
{'testcases/Test module|line with type|type without title|name=y', ''},
{'system=testcases/Test module|line=line with type|type=type with title and shortname|name=y', ''},
{'testcases/Test module|line=line with type|type with title and shortname|name=y', ''},
-- Use short name?
{'system=testcases/Test module|line=line with type|type=line without title and with shortname|name=y', ''},
{'testcases/Test module|line with type|line without title and with shortname|name=y', ''},
})
end
-- Need tests for:
--- |size= – image size, expressed as width (15px), height (x15px) or both if necessary (15x15px).
--- |link= – image link (full page name)
--- |alt= – alt text
--- |bold= – setting for some types of text-based icon; default is "yes" for all of those types
function p:test_04_errors()
-- No module.
self:preprocess_equals('{{#invoke:Adjacent stations/sandbox|icon|system=Taipei|R}}', '')
-- No type for line.
self:preprocess_equals('{{#invoke:Adjacent stations/sandbox|icon|system=testcases/Test module|line=line with type|type=222222}}', '<span class="scribunto-error" id="mw-scribunto-error-0">Lua error: Type "22222" for line "line with type" not in [[Module:Adjacent stations/testcases/Test module]].</span>')
end
return p