வார்ப்புரு:Testcase table/doc
{{Documentation subpage}}
 {{Lua|Module:Template test case}}
 &lt;!-- Categories where indicated at the bottom of this page, please; interwikis at Wikidata --&gt;
 
 This template generates a table of side-by-side testcases comparing two or more templates. Each template is called with the same parameters.
 
 All parameters passed to this template are passed through to the test-case templates, with the exception of parameters starting with an underscore character (&quot;_&quot;), which are reserved for internal use.
 
 If no templates are specified explicitly, the module uses the base page of the current page as the first template, and its /sandbox subpage as the second template. If only one template is specified explicitly, its /sandbox subpage is used as the second template.
 
 == Usage ==
 
 '''Basic syntax'''
 &lt;pre&gt;
 {{Testcase table
 | [param1] = [value1]
 | [param2] = [value2]
 | [param3] = [value3]
 ...
 }}
 &lt;/pre&gt;
 
 '''Full syntax'''
 &lt;pre&gt;
 {{Testcase table
 | _format      = 
 | _class       = 
 | _style       = 
 | _caption     = 
 | _rowheader   = 
 | _heading0    = 
 | _before      = 
 | _after       = 
 | _collapsible = 
 | _resetRefs   = 
 | _code        = 
 | _showcode    = 
 | _showheader  = 
 
 | _template      = 
 | _template1     = 
 | _showtemplate1 = 
 | _heading1      = 
 | _template2     = 
 | _showtemplate2 = 
 | _heading2      = 
 | _template3     = 
 | _showtemplate3 = 
 | _heading3      = 
 ...
 
 | [param1] = [value1]
 | [param2] = [value2]
 | [param3] = [value3]
 ...
 }}
 &lt;/pre&gt;
 
 == Parameters ==
 
 {| class=&quot;wikitable&quot;
 ! Parameter !! Description
 |-
 | &lt;code&gt;_template1&lt;/code&gt;&lt;br/&gt;&lt;code&gt;_template2&lt;/code&gt;&lt;br/&gt;''(etc)'' || Names of the templates to be processed. &lt;code&gt;_template1&lt;/code&gt;'s default is the current page's {{tlx|basepage}}. If &lt;code&gt;_template1&lt;/code&gt; is specified, the default for &lt;code&gt;_template2&lt;/code&gt; is its /sandbox [[Wikipedia:Subpages|subpage]]; if not, the default for &lt;code&gt;_template2&lt;/code&gt; is the /sandbox subpage of the current page's basepage. Template names should be entered as you would use them in a normal template invocation, i.e. &quot;3x&quot;, not &quot;Template:3x&quot;. If you need to test a page in the main namespace you can use a colon prefix, i.e. &quot;:''article name''&quot;.
 |-
 | &lt;code&gt;_template&lt;/code&gt; || Alias for &lt;code&gt;_template1&lt;/code&gt;. If both &lt;code&gt;_template&lt;/code&gt; and &lt;code&gt;_template1&lt;/code&gt; are specified, &lt;code&gt;_template&lt;/code&gt; will take precedence.
 |-
 | &lt;code&gt;_showtemplate1&lt;/code&gt;, &lt;code&gt;_showtemplate2&lt;/code&gt;, &lt;code&gt;_showtemplate3&lt;/code&gt;... || If this is set to &quot;no&quot;, then no output is shown for that template. This is useful if you only want to show the main template, or if you only want to show the sandbox template.
 |-
 | &lt;code&gt;_heading1&lt;/code&gt;&lt;br/&gt;&lt;code&gt;_heading2&lt;/code&gt;&lt;br/&gt;''(etc)'' || Custom headings for each of the templates.
 |-
 | &lt;code&gt;_showheader&lt;/code&gt; || If this is set to &quot;no&quot;, then no headers are shown.
 |-
 | &lt;code&gt;_class&lt;/code&gt; || HTML classes for the table. Use {{para|_class|wikitable}} to format the table as a wikitable.
 |-
 | &lt;code&gt;_style&lt;/code&gt; || Custom inline CSS for the table.
 |-
 | &lt;code&gt;_caption&lt;/code&gt; || Custom caption for the table. The default is &quot;Side by side comparison&quot;.
 |-
 | &lt;code&gt;_rowheader&lt;/code&gt; || An extra heading for the row containing the templates.
 |-
 | &lt;code&gt;_heading0&lt;/code&gt; || If &lt;code&gt;_rowheader&lt;/code&gt; is supplied, this is an optional heading above it in the template row.
 |-
 | &lt;code&gt;_before&lt;/code&gt;, &lt;code&gt;_after&lt;/code&gt; || This text is displayed before or after (respectively) the output of each template. These parameters introduce no whitespace on their own.
 |-
 | &lt;code&gt;_collapsible&lt;/code&gt; || If set to &quot;yes&quot;, the test case is made collapsible. The test case is collapsed and given a green heading if all the template outputs are the same. If any of the template outputs differ, the test case is expanded and given a yellow heading.
 |-
 | &lt;code&gt;_resetRefs&lt;/code&gt; || If set to &quot;yes&quot;, any references generated by the templates tested are reset after each template is expanded.
 |-
 | &lt;code&gt;_showcode&lt;/code&gt; || Show the template code used to make the test case. If an invocation is specified with the &lt;code&gt;_code&lt;/code&gt; parameter, then that is used. Otherwise, an approximation is generated from the arguments. This approximation is not perfect (whitespace in named arguments is lost; duplicate arguments are ignored) but it should be fine for template code that is input all on one line without spaces between parameters.
 |-
 | &lt;code&gt;_code&lt;/code&gt; || Used to specify template code inside {{tag|nowiki}} tags. This is used with the _showcode option to display the template invocation while preserving whitespace. You must use the magic word &quot;__TEMPLATENAME__&quot; instead of the template name. For example: {{para|1=_code|2=&amp;lt;nowiki&amp;gt;&lt;nowiki&gt;{{__TEMPLATENAME__|first|second|foo=bar}}&lt;/nowiki&gt;&amp;lt;/nowiki&amp;gt;}}. If you find yourself using this option a lot, you may want to consider using {{tl|Test case nowiki}}, which allows you to generate the entire test case from template code in nowiki tags, saving you from typing in all the arguments twice. &lt;p&gt;Note: due to the way nowiki tags work, the template treats the [[HTML entities]] &amp;amp;lt;, &amp;amp;gt; and &amp;amp;quot; as if they were the literal characters &amp;lt;, &amp;gt; and &quot; when used with this parameter.&lt;/p&gt;
 |-
 | &lt;code&gt;_format&lt;/code&gt; || It is possible to use this parameter to display completely different formats, for example test cases arranged in rows. Not all of the parameters here will work with the other formats. For details, see [[Template:Test case]]'s documentation.
 |}
 
 == Examples ==
 
 ===Example 1===
 using [[Template:Year in South Africa]], with {{para|_showcode|true}}
 
 ;Usage
 &lt;pre style=&quot;white-space:pre-wrap; overflow:auto; background-color:#eee;&quot;&gt;
 {{Testcase table
 |_template=Year in South Africa
 |_showcode=true
 |1600s |nocat=true
 }}
 &lt;/pre&gt;
 
 ;Output
 {{Testcase table
 |_template=Year in South Africa
 |_showcode=true
 |1600s |nocat=true
 }}
 
 ===Example 2===
 using [[Template:Infobox]], with {{para|_showcode|true}} and {{para|_caption|&amp;amp;nbsp;}}
 
 ;Usage
 &lt;pre style=&quot;white-space:pre-wrap; overflow:auto; background-color:#eee;&quot;&gt;
 {{Testcase table
 |_template=Infobox
 |_showcode=true
 |_caption=&amp;amp;nbsp;
 |title=title |above=above
 |header1=header1
 |label2=label2 |data2=data2
 |label3=label3 |data3=data3
 |below=below
 }}
 &lt;/pre&gt;
 
 ;Output
 {{Testcase table
 |_template=Infobox
 |_showcode=true
 |_caption=&amp;nbsp;
 |title=title |above=above
 |header1=header1
 |label2=label2 |data2=data2
 |label3=label3 |data3=data3
 |below=below
 }}
 
 == Technical limitations ==
 
 See [[Template:Test case#Technical limitations]] for this template's known technical limitations.
 
 == See also ==
 Templates invoking [[Module:Template test case]]:
 * [[Template:Test case]] – a generalised test case template
 * [[Template:Testcase rows]] – for a table of test cases arranged in rows
 * [[Template:Inline test case]] – for test cases with small invocations and small output
 * [[Template:Collapsible test case]] – for test cases collapsed by default if the results are the same
 * [[Template:Test case nowiki]] – for test cases from template invocations enclosed in {{tag|nowiki}} tags
 * [[Template:Nowiki template demo]] – for use in template documentation
 Other templates:
 * [[Template:Parameter names example]] – produces an example of a template by using the names of that template's parameters as the values for those parameters.
 
 &lt;includeonly&gt;{{When on basepage
 | &lt;!-- Categories below here, please; interwikis at Wikidata --&gt;
 [[Category:Template test cases| ]]
 [[Category:Template namespace templates]]