Module:Template test case/testcases

From IDU Wiki
Jump to navigation Jump to search

-- Unit tests for Module:Template test case. Click talk page to run tests.

local p = require('Module:UnitTests')

function p:test01_columns()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

_caption
_heading0_heading1_heading2_heading3
_rowheader _beforeError: expandTemplate: template "Commons-inline" does not exist_after _beforeError: expandTemplate: template "Commons category-inline" does not exist_after _beforeError: expandTemplate: template "Commons and category-inline" does not exist_after

'

       )

end

function p:test01_columns_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

_caption
_heading0_heading1_heading2_heading3
_rowheader _beforeError: expandTemplate: template "Commons-inline" does not exist_after _beforeError: expandTemplate: template "Commons category-inline" does not exist_after _beforeError: expandTemplate: template "Commons and category-inline" does not exist_after

',

       {nowiki=1}
   )

end

function p:test02_showheader()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

Error: expandTemplate: template "Commons-inline" does not exist Error: expandTemplate: template "Commons category-inline" does not exist Error: expandTemplate: template "Commons and category-inline" does not exist

'

       )

end

function p:test02_showheader_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

Error: expandTemplate: template "Commons-inline" does not exist Error: expandTemplate: template "Commons category-inline" does not exist Error: expandTemplate: template "Commons and category-inline" does not exist

',

       {nowiki=1}
   )

end

function p:test03_caption()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

 
{{Commons-inline}}{{Commons category-inline}}{{Commons and category-inline}}
Error: expandTemplate: template "Commons-inline" does not exist Error: expandTemplate: template "Commons category-inline" does not exist Error: expandTemplate: template "Commons and category-inline" does not exist

'

       )

end

function p:test03_caption_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

 
{{Commons-inline}}{{Commons category-inline}}{{Commons and category-inline}}
Error: expandTemplate: template "Commons-inline" does not exist Error: expandTemplate: template "Commons category-inline" does not exist Error: expandTemplate: template "Commons and category-inline" does not exist

',

       {nowiki=1}
   )

end

function p:test04_showcaption()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

{{Commons-inline}}{{Commons category-inline}}{{Commons and category-inline}}
Error: expandTemplate: template "Commons-inline" does not exist Error: expandTemplate: template "Commons category-inline" does not exist Error: expandTemplate: template "Commons and category-inline" does not exist

'

       )

end

function p:test04_showcaption_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Commons-inline" does not exist.',

'

{{Commons-inline}}{{Commons category-inline}}{{Commons and category-inline}}
Error: expandTemplate: template "Commons-inline" does not exist Error: expandTemplate: template "Commons category-inline" does not exist Error: expandTemplate: template "Commons and category-inline" does not exist

',

       {nowiki=1}
   )

end

function p:test05_addline()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',
       '
  • {{Height|m=1.51}} → Error: expandTemplate: template "Height" does not exist
  • {{Height/sandbox|m=1.51}} → Error: expandTemplate: template "Height/sandbox" does not exist
  • Output of Convert template: Template:Cvt'
       )

end

function p:test05_addline_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',
       '
  • {{Height|m=1.51}} → Error: expandTemplate: template "Height" does not exist
  • {{Height/sandbox|m=1.51}} → Error: expandTemplate: template "Height/sandbox" does not exist
  • Output of Convert template: Template:Cvt',
       {nowiki=1}
   )

end

function p:test06a_output_default()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}

{{Height}}

<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>

{{Height/sandbox}}

<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>'

       )

end

function p:test06a_output_default_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}

{{Height}}

<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>

{{Height/sandbox}}

<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>',

       {nowiki=1}
       )

end

function p:test06b_output_default()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}

{{Height}}

Error: expandTemplate: template "Height" does not exist

<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>

{{Height/sandbox}}

Error: expandTemplate: template "Height/sandbox" does not exist

<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

'

       )

end

function p:test06b_output_default_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}

{{Height}}

Error: expandTemplate: template "Height" does not exist

<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>

{{Height/sandbox}}

Error: expandTemplate: template "Height/sandbox" does not exist

<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

',

       {nowiki=1}
       )

end

function p:test07a_output_columns()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
Side by side comparison
{{Height}}{{Height/sandbox}}
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong> <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

'

       )

end

function p:test07a_output_columns_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
Side by side comparison
{{Height}}{{Height/sandbox}}
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong> <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

',

       {nowiki=1}
       )

end

function p:test07b_output_columns()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
Side by side comparison
{{Height}}{{Height/sandbox}}
Error: expandTemplate: template "Height" does not exist
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
Error: expandTemplate: template "Height/sandbox" does not exist
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

'

       )

end

function p:test07b_output_columns_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
Side by side comparison
{{Height}}{{Height/sandbox}}
Error: expandTemplate: template "Height" does not exist
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
Error: expandTemplate: template "Height/sandbox" does not exist
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

',

       {nowiki=1}
       )

end

function p:test08a_output_rows()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

'

       )

end

function p:test08a_output_rows_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

',

       {nowiki=1}
       )

end

function p:test08b_output_rows()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}
Error: expandTemplate: template "Height" does not exist
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}
Error: expandTemplate: template "Height/sandbox" does not exist
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

'

       )

end

function p:test08b_output_rows_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}
Error: expandTemplate: template "Height" does not exist
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}
Error: expandTemplate: template "Height/sandbox" does not exist
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

',

       {nowiki=1}
       )

end

function p:test09a_output_tablerows()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}→ <strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}→ <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

'

       )

end

function p:test09a_output_tablerows_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}→ <strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}→ <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

',

       {nowiki=1}
       )

end

function p:test09b_output_tablerows()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}→ Error: expandTemplate: template "Height" does not exist
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}→ Error: expandTemplate: template "Height/sandbox" does not exist
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

'

       )

end

function p:test09b_output_tablerows_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',

'

{{Height|m=1.51}}
{{Height}}→ Error: expandTemplate: template "Height" does not exist
<strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
{{Height/sandbox}}→ Error: expandTemplate: template "Height/sandbox" does not exist
<strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>

',

       {nowiki=1}
       )

end

function p:test10a_output_inline()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',
       '
  • {{Height|m=1.51}} → <strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
  • {{Height/sandbox|m=1.51}} → <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>'
       )

end

function p:test10a_output_inline_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',
       '
  • {{Height|m=1.51}} → <strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
  • {{Height/sandbox|m=1.51}} → <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>',
       {nowiki=1}
       )

end

function p:test10b_output_inline()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',
       '
  • {{Height|m=1.51}} → Error: expandTemplate: template "Height" does not exist
    <strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
  • {{Height/sandbox|m=1.51}} → Error: expandTemplate: template "Height/sandbox" does not exist
    <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>
    '
       )

end

function p:test10b_output_inline_nowiki()

   self:preprocess_equals_preprocess(
       'Lua error: expandTemplate: template "Height" does not exist.',
       '
  • {{Height|m=1.51}} → Error: expandTemplate: template "Height" does not exist
    <strong class="error">Error: expandTemplate: template "Height" does not exist</strong>
  • {{Height/sandbox|m=1.51}} → Error: expandTemplate: template "Height/sandbox" does not exist
    <strong class="error">Error: expandTemplate: template "Height/sandbox" does not exist</strong>
    ',
       {nowiki=1}
       )

end

return p