Content deleted Content added
update |
Properly use stripmarker |
||
(24 intermediate revisions by 4 users not shown) | |||
Line 1:
-- Unit tests for [[Module:Template test case]]. Click talk page to run tests.
local p = require('Module:UnitTests
function p:test01_columns()
Line 66:
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_format=inline |_showcode=yes |_template1=Height |m=1.51 |_addline=Output of Convert template: {{Cvt|1.51|m|frac=2}} }}',
'{{#invoke:Template test case |main |_format=inline |_showcode=yes |_template1=Height |m=1.51 |_addline=Output of Convert template: {{Cvt|1.51|m|frac=2}} }}',
{stripmarker=true}
)
end
Line 74 ⟶ 75:
'{{#invoke:Template test case/sandbox |main |_format=inline |_showcode=yes |_template1=Height |m=1.51 |_addline=Output of Convert template: {{Cvt|1.51|m|frac=2}} }}',
'{{#invoke:Template test case |main |_format=inline |_showcode=yes |_template1=Height |m=1.51 |_addline=Output of Convert template: {{Cvt|1.51|m|frac=2}} }}',
{nowiki=1,stripmarker=true}
)
end
function p:test06_output()
self:preprocess_equals_preprocess(▼
'{{#invoke:Template test case/sandbox |main |_output=nowiki |_format=inline |_showcode=yes |_template1=Height |m=1.51}}',▼
'{{#invoke:Template test case |main |_output=nowiki |_format=inline |_showcode=yes |_template1=Height |m=1.51}}'▼
)▼
end▼
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_output=nowiki |_format=inline |_showcode=yes |_template1=Height |m=1.51}}',
'{{#invoke:Template test case |main |_output=nowiki |_format=inline |_showcode=yes |_template1=Height |m=1.51}}',
{
)
end
function p:test07_output()
self:preprocess_equals_preprocess(▼
'{{#invoke:Template test case/sandbox |main |_output=nowiki+ |_format=inline |_showcode=yes |_template1=Height |m=1.51}}',▼
'{{#invoke:Template test case |main |_output=nowiki+ |_format=inline |_showcode=yes |_template1=Height |m=1.51}}'▼
)▼
end▼
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_output=nowiki+ |_format=inline |_showcode=yes |_template1=Height |m=1.51}}',
'{{#invoke:Template test case |main |_output=nowiki+ |_format=inline |_showcode=yes |_template1=Height |m=1.51}}',
{
)
end
function p:test08_prefix()
self:preprocess_equals_preprocess(▼
'{{#invoke:Template test case/sandbox |main |_format=inline |_prefix=# |_showcode=yes |_template1=Height |m=1.51}}',▼
'{{#invoke:Template test case |main |_format=inline |_prefix=# |_showcode=yes |_template1=Height |m=1.51}}'▼
)▼
end▼
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_format=inline |_prefix=# |_showcode=yes |_template1=Height |m=1.51}}',
'{{#invoke:Template test case |main |_format=inline |_prefix=# |_showcode=yes |_template1=Height |m=1.51}}',
{
)
end
function p:test09_prefix()
self:preprocess_equals_preprocess(▼
'{{#invoke:Template test case/sandbox |main |_format=inline |_prefix=: |_template1=Height |m=1.51}}',▼
'{{#invoke:Template test case |main |_format=inline |_prefix=: |_template1=Height |m=1.51}}'▼
)▼
end▼
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_format=inline |_prefix=: |_template1=Height |m=1.51}}',
'{{#invoke:Template test case |main |_format=inline |_prefix=: |_template1=Height |m=1.51}}',
{
)
end
Line 141 ⟶ 114:
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_showcode=yes |_template=Height |m=1.51}}',
'{{#invoke:Template test case |main |_collapsible=yes |_showcode=yes |_template=Height |m=1.51}}',
{stripmarker=true}
)
end
Line 149 ⟶ 123:
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_showcode=yes |_template=Height |m=1.51}}',
'{{#invoke:Template test case |main |_collapsible=yes |_showcode=yes |_template=Height |m=1.51}}',
{stripmarker=true, nowiki=
)
end
Line 156 ⟶ 130:
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_showcode=yes |_title=Testing height template |_template=Height |m=1.51}}',
'{{#invoke:Template test case |main |_collapsible=yes |_showcode=yes |_title=Testing height template |_template=Height |m=1.51}}',
{stripmarker=true}
)
end
Line 164 ⟶ 139:
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_showcode=yes |_title=Testing height template |_template=Height |m=1.51}}',
'{{#invoke:Template test case |main |_collapsible=yes |_showcode=yes |_title=Testing height template |_template=Height |m=1.51}}',
{stripmarker=true, nowiki=
)
end
Line 171 ⟶ 146:
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_titlecode=yes |_template=Height |m=1.51}}',
'{{#invoke:Template test case |main |_collapsible=yes |_titlecode=yes |_template=Height |m=1.51}}',
{stripmarker=true}
)
end
Line 179 ⟶ 155:
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_titlecode=yes |_template=Height |m=1.51}}',
'{{#invoke:Template test case |main |_collapsible=yes |_titlecode=yes |_template=Height |m=1.51}}',
{nowiki=
)
end
function p:test13_wantdiff()
▲ self:preprocess_equals_preprocess(
▲ '{{#invoke:Template test case/sandbox |main |
▲ '{{#invoke:Template test case |main |
{stripmarker=true}
▲ )
▲end
function p:test13_wantdiff_nowiki()
▲ self:preprocess_equals_preprocess(
▲ '{{#invoke:Template test case/sandbox |main |
▲ '{{#invoke:Template test case |main |
{stripmarker=true, nowiki=true}
▲ )
▲end
function p:test13_wantdiff_2_wiki()
▲ self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_wantdiff=yes |_showcode=yes |_template1=Commons-inline |_template2=Commons category-inline |Lorem ipsum|Lorem ipsum}}',
'{{#invoke:Template test case |main |_collapsible=yes |_wantdiff=yes |_showcode=yes |_template1=Commons-inline |_template2=Commons category-inline |Lorem ipsum|Lorem ipsum}}',
{stripmarker=true}
▲ )
▲end
function p:test13_wantdiff_2()
▲ self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_wantdiff=yes |_showcode=yes |_template1=Commons-inline |_template2=Commons category-inline |Lorem ipsum|Lorem ipsum}}',
'{{#invoke:Template test case |main |_collapsible=yes |_wantdiff=yes |_showcode=yes |_template1=Commons-inline |_template2=Commons category-inline |Lorem ipsum|Lorem ipsum}}',
{stripmarker=true, nowiki=true}
▲ )
▲end
function p:test13_wantdiff_3()
self:preprocess_equals_preprocess(
▲ '{{#invoke:Template test case/sandbox |main |
▲ '{{#invoke:Template test case |main |
{stripmarker=true}
)
end
function p:test13_wantdiff_3_nowiki()
self:preprocess_equals_preprocess(
▲ '{{#invoke:Template test case/sandbox |main |
▲ '{{#invoke:Template test case/sandbox
{stripmarker=true, nowiki=true}
)
end
function p:test14_equals_sign_parameter()
self:preprocess_equals_preprocess(
'{{#invoke:Template test case/sandbox |main |_collapsible=yes |_wantdiff=yes |_showcode=yes |_template=3x |{{=}}|name=value}}',
'{{#invoke:Template test case |main |_collapsible=yes |_wantdiff=yes |_showcode=yes |_template=3x |{{=}}|name=value}}',
{stripmarker=true, nowiki=true}
)
end
return p
|