Template:Test case nowiki/doc

This template generates a test case for two or more templates. Each template is called with the same parameters, and the test case can be displayed in various different formats.

The template output and the template invocations are generated from template code passed inside  tags passed to the code or 1 parameters. In this template code, you must use the magic word  instead of the normal template name.

Template names are specified parameters like template1 and template2, etc. 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

Common syntax

The following options will work with all different test case formats.

Some test case formats accept additional parameters as well. See their sections for documentation.

Parameters
The default test case format doesn't have any extra parameters.

The inline format is for test cases that can be displayed entirely on one line. If used with templates that display on multiple lines it may produce unexpected results. It doesn't have any extra parameters.

The columns format arranges the test cases side by side in a table. This is useful for comparing long and thin templates such as infoboxes. It has the following extra parameters:

The rows format arranges the test cases in rows in a table. It has the following extra parameters:

You can use yes with any format to turn it into a collapsible test case. If all the template outputs are the same the test case is collapsed and given a green heading. If any of the template outputs differ, the test case is expanded and given a yellow heading. You can set a custom title for collapsible test cases with the title parameter.

Default

 * Usage


 * Output

Default, collapsible

 * Usage


 * Output

Default, collapsible, different output

 * Usage


 * Output

Inline
using Template:3x 
 * Usage


 * Output

Note: As this format starts with a bullet, a newline will always be inserted at the start of the template output due to bug 14974.

Inline, collapsible

 * Usage


 * Output

Columns

 * Usage


 * Output

Columns, collapsible

 * Usage


 * Output

Rows

 * Usage


 * Output

Rows, collapsible

 * Usage


 * Output

Technical limitations
The template has the following known technical limitations:
 * An error will be generated if processing the entire page takes more than 10 seconds. This is an intentional limit in the Scribunto extension that runs Module:Template test case, on which this template is based. If a test cases page takes more than 10 seconds to load, you may need to split it up into different pages.
 * The template converts the HTML entities &amp;lt;, &amp;gt; and &amp;quot; inside template invocations to the literal characters &lt;, &gt; and &quot;. This is due to the way nowiki tags work.
 * For collapsible test cases, all text inside extension tags (e.g., , and ) is treated as equal. These tags are converted to strip markers before they are passed to the template, and all strip markers include a random string as they have to be unique. Even if strip markers were unstripped before being compared, the same wikitext would not be guaranteed to result in exactly the same unstripped code. So this module ignores the content of strip markers for the purposes of testing equality. This has the unwanted side effect that, e.g.   is treated as equal to  , but should be adequate for most uses.