Template:Test case
File:Lua-Logo.svg | This template uses Lua: |
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.
All parameters passed to this template are passed through to the test-case templates, with the exception of parameters starting with an underscore character ("_"), 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
{{test case | [param1] = [value1] | [param2] = [value2] | [param3] = [value3] ... }}
Common syntax
The following options will work with all different test case formats.
{{test case | _format = | _output = | _collapsible = | _resetRefs = | _code = | _showcode = | _template = | _template1 = | _heading1 = | _template2 = | _heading2 = | _template3 = | _heading3 = ... | [param1] = [value1] | [param2] = [value2] | [param3] = [value3] ... }}
Some test case formats accept additional parameters as well. See their sections for documentation.
Common parameters
Parameter | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
_format |
The format used to display the test cases. This can be "columns", "rows", "tablerows", "inline" or "default". | ||||||||||
_output |
Allows changes in how the template's output is displayed. The default output is displayed when the
UsageWraps a short span of text in If the content includes an equals sign (=), you must specify the parameter explicitly: The template uses the
However,
Use
When used inline with regular text,
is well spaced:
versus:
which is going to be visually confusing for many:
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font. Use parameter {{{2}}} (unnamed, as This template does not need to be substituted. Examples
Included templatesEmbedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
The above example shows the HTML rendered by the citation template, including the hidden metadata. TemplateDataThis is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. Click here to see a monthly parameter usage report for this template based on this TemplateData.
Script error: No such module "Format TemplateData".
TemplateData for Test case See also
|_output=nowiki ; this is helpful when there are differences in the underlying wikitext which are not visible in the default output. Both the default output and nowiki version are displayed when |_output=nowiki+ .
| ||||||||||
_collapsible |
If set to "y" or "yes", 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. See #Collapsible test cases for other parameters which only work when _collapsible is enabled. | ||||||||||
_template1 , _template2 , _template3 ... |
The names of the templates to be processed. The default of _template1 is the base page of the current page. If _template1 is specified, the default for _template2 is its /sandbox subpage; if not, the default for _template2 is the /sandbox subpage of the base page of the current page. Template names should be entered as you would use them in a normal template invocation, i.e. "3x", not "Template:3x". If you need to test a page in the main namespace you can use a colon prefix, i.e. ":article name". | ||||||||||
_template |
An alias for _template1. If both _template and _template1 are specified, _template will take precedence. | ||||||||||
_showtemplate1 , _showtemplate2 , _showtemplate3 ... |
If this is set to "no", 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. | ||||||||||
_heading1 , _heading2 , _heading3 ... |
Custom headings for each of the templates. | ||||||||||
_showheader |
If this is set to "n" or "no", then no headers are shown. | ||||||||||
_before , _after |
Optional text to display before and after the output of each template. | ||||||||||
_resetRefs |
If set to "y" or "yes", any references generated by the templates tested are reset after each template is expanded. | ||||||||||
_showcode |
Show the template code used to make the test case. If an invocation is specified with the _code parameter, then that is used. Otherwise, an approximation is generated from the arguments. This approximation is not perfect - white space in named arguments is lost, and duplicate arguments are ignored - but it should be fine for template code that is input all on one line without spaces between parameters. | ||||||||||
_code |
Used to specify template code inside <nowiki>...</nowiki> tags. This is used with the _showcode option to display the template invocation while preserving white space. You must use the magic word "__TEMPLATENAME__" instead of the template name. For example: | _code = <nowiki>{{__TEMPLATENAME__|first|second|foo=bar}}</nowiki> . If you find yourself using this option a lot, you may want to consider using {{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. Note: due to the way nowiki tags work, the template treats the HTML entities <, > and " as if they were the literal characters <, > and " when used with this parameter. |
Test case formats
Default format
This format is used when
This template is used on 24,000+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
Wraps a short span of text in <syntaxhighlight>
tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre>
or <syntaxhighlight>...</syntaxhighlight>
. See Help:Wiki markup for an explanation of what the various tags do.
If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}
.
The template uses the <syntaxhighlight>
tag with the attribute inline=1
. This works like the combination of the <code>
and <nowiki>
tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}}
will not render the word "wiki" in bold, and will render the tripled-single-quotes:
- Template loop detected: Template:Code
However, {{code|a {{template}} call}}
will still invoke the template:
- Template loop detected: Template:Code
Use <nowiki>...</nowiki>
around the template name to avoid this problem:
- Template loop detected: Template:Code
When used inline with regular text, {{code}}
generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:
- Template loop detected: Template:Code
is well spaced:
- foo Template loop detected: Template:Code quux.
versus:
- Template loop detected: Template:Code
which is going to be visually confusing for many:
- foo Template loop detected: Template:Code quux.
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.
Use parameter {{{2}}} (unnamed, as |2=
, or more explicitly as |lang=
) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.
This template does not need to be substituted.
Examples
Markup | Renders asScript error: No such module "For loop". |
---|---|
Included templates
Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code>
as a wrapper instead of this template.
Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
Markup | Renders asScript error: No such module "For loop". |
---|---|
The above example shows the HTML rendered by the citation template, including the hidden metadata.
TemplateData
TemplateData for Test case
See also
- {{codett}}, wrapper for this template that removes background and border styling
- {{mono}}, monospaced font only
- {{param value}}, monospaced; friendly handling for blank space
- {{Syntaxhighlight}}
- {{kbd}}, for keyboard input
- Help:Wiki markup
|_format=default
. It does not have any extra parameters.
Example
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
{{ombox/sandbox}}
Error: expandTemplate: template "ombox/sandbox" does not exist
Columns format
Use |_format=columns
to arrange 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:
Parameter | Description |
---|---|
_class |
HTML classes for the table. Use |_class=wikitable to format the table as a wikitable.
|
_style |
Custom inline CSS for the table. |
_caption |
Custom caption for the table. The default is "Side by side comparison". |
_rowheader |
An extra heading for the row containing the templates. |
_heading0 |
If _rowheader is supplied, this is an optional heading above it in the template row. |
Example
{{ombox}} | {{ombox/sandbox}} | ||
---|---|---|---|
| Error: expandTemplate: template "ombox/sandbox" does not exist |
Rows and tablerows formats
Use |_format=rows
or |_format=tablerows
to arrange the test cases one above another in a table. These two formats differ in the placement of the headings:
This template is used on 24,000+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
Wraps a short span of text in <syntaxhighlight>
tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre>
or <syntaxhighlight>...</syntaxhighlight>
. See Help:Wiki markup for an explanation of what the various tags do.
If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}
.
The template uses the <syntaxhighlight>
tag with the attribute inline=1
. This works like the combination of the <code>
and <nowiki>
tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}}
will not render the word "wiki" in bold, and will render the tripled-single-quotes:
- Template loop detected: Template:Code
However, {{code|a {{template}} call}}
will still invoke the template:
- Template loop detected: Template:Code
Use <nowiki>...</nowiki>
around the template name to avoid this problem:
- Template loop detected: Template:Code
When used inline with regular text, {{code}}
generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:
- Template loop detected: Template:Code
is well spaced:
- foo Template loop detected: Template:Code quux.
versus:
- Template loop detected: Template:Code
which is going to be visually confusing for many:
- foo Template loop detected: Template:Code quux.
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.
Use parameter {{{2}}} (unnamed, as |2=
, or more explicitly as |lang=
) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.
This template does not need to be substituted.
Examples
Markup | Renders asScript error: No such module "For loop". |
---|---|
Included templates
Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code>
as a wrapper instead of this template.
Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
Markup | Renders asScript error: No such module "For loop". |
---|---|
The above example shows the HTML rendered by the citation template, including the hidden metadata.
TemplateData
TemplateData for Test case
See also
- {{codett}}, wrapper for this template that removes background and border styling
- {{mono}}, monospaced font only
- {{param value}}, monospaced; friendly handling for blank space
- {{Syntaxhighlight}}
- {{kbd}}, for keyboard input
- Help:Wiki markup
This template is used on 24,000+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
Wraps a short span of text in <syntaxhighlight>
tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre>
or <syntaxhighlight>...</syntaxhighlight>
. See Help:Wiki markup for an explanation of what the various tags do.
If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}
.
The template uses the <syntaxhighlight>
tag with the attribute inline=1
. This works like the combination of the <code>
and <nowiki>
tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}}
will not render the word "wiki" in bold, and will render the tripled-single-quotes:
- Template loop detected: Template:Code
However, {{code|a {{template}} call}}
will still invoke the template:
- Template loop detected: Template:Code
Use <nowiki>...</nowiki>
around the template name to avoid this problem:
- Template loop detected: Template:Code
When used inline with regular text, {{code}}
generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:
- Template loop detected: Template:Code
is well spaced:
- foo Template loop detected: Template:Code quux.
versus:
- Template loop detected: Template:Code
which is going to be visually confusing for many:
- foo Template loop detected: Template:Code quux.
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.
Use parameter {{{2}}} (unnamed, as |2=
, or more explicitly as |lang=
) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.
This template does not need to be substituted.
Examples
Markup | Renders asScript error: No such module "For loop". |
---|---|
Included templates
Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code>
as a wrapper instead of this template.
Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
Markup | Renders asScript error: No such module "For loop". |
---|---|
The above example shows the HTML rendered by the citation template, including the hidden metadata.
TemplateData
TemplateData for Test case
See also
- {{codett}}, wrapper for this template that removes background and border styling
- {{mono}}, monospaced font only
- {{param value}}, monospaced; friendly handling for blank space
- {{Syntaxhighlight}}
- {{kbd}}, for keyboard input
- Help:Wiki markup
Parameter | Description |
---|---|
_class |
HTML classes for the table. Use |_class=wikitable to format the table as a wikitable.
|
_style |
Custom inline CSS for the table. |
_caption |
Custom caption for the table. |
Example – rows
{{ombox}} | ||
| ||
{{ombox/sandbox}} | ||
Error: expandTemplate: template "ombox/sandbox" does not exist |
Example – tablerows
{{ombox}} | → |
| ||
---|---|---|---|---|
{{ombox/sandbox}} | → | Error: expandTemplate: template "ombox/sandbox" does not exist |
Inline format
Use |_format=inline
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. This format creates a bulleted list by placing *
before each line of output. It has the following extra parameters:
Parameter | Description |
---|---|
_addline |
Text to be added as last line in list, after the template output. |
_prefix |
Character to replace * before each line of output. Using |_prefix=# would display a numbered list.
|
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.
Examples (using Template:3x)
Default:
- Error: expandTemplate: template "3x" does not exist
- Error: expandTemplate: template "3x/sandbox" does not exist
With |_showcode=yes
:
{{3x|Lorem ipsum }}
→ Error: expandTemplate: template "3x" does not exist{{3x/sandbox|Lorem ipsum }}
→ Error: expandTemplate: template "3x/sandbox" does not exist
Example (using Template:Height)
With |_prefix=#
and |_addline=
:
{{Height|m=1.51}}
→ Error: expandTemplate: template "Height" does not exist{{Height/sandbox|m=1.51}}
→ Error: expandTemplate: template "Height/sandbox" does not exist{{Cvt|1.51|m|frac=2}}
→ Template:Cvt
Output
The
This template is used on 24,000+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
Wraps a short span of text in <syntaxhighlight>
tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre>
or <syntaxhighlight>...</syntaxhighlight>
. See Help:Wiki markup for an explanation of what the various tags do.
If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}
.
The template uses the <syntaxhighlight>
tag with the attribute inline=1
. This works like the combination of the <code>
and <nowiki>
tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}}
will not render the word "wiki" in bold, and will render the tripled-single-quotes:
- Template loop detected: Template:Code
However, {{code|a {{template}} call}}
will still invoke the template:
- Template loop detected: Template:Code
Use <nowiki>...</nowiki>
around the template name to avoid this problem:
- Template loop detected: Template:Code
When used inline with regular text, {{code}}
generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:
- Template loop detected: Template:Code
is well spaced:
- foo Template loop detected: Template:Code quux.
versus:
- Template loop detected: Template:Code
which is going to be visually confusing for many:
- foo Template loop detected: Template:Code quux.
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.
Use parameter {{{2}}} (unnamed, as |2=
, or more explicitly as |lang=
) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.
This template does not need to be substituted.
Examples
Markup | Renders asScript error: No such module "For loop". |
---|---|
Included templates
Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code>
as a wrapper instead of this template.
Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
Markup | Renders asScript error: No such module "For loop". |
---|---|
The above example shows the HTML rendered by the citation template, including the hidden metadata.
TemplateData
TemplateData for Test case
See also
- {{codett}}, wrapper for this template that removes background and border styling
- {{mono}}, monospaced font only
- {{param value}}, monospaced; friendly handling for blank space
- {{Syntaxhighlight}}
- {{kbd}}, for keyboard input
- Help:Wiki markup
|format=tablerows
.
Default output
The default output is displayed when the
This template is used on 24,000+ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
Usage
Wraps a short span of text in <syntaxhighlight>
tags (see mw:Extension:SyntaxHighlight). This template should be used for short samples; longer content should use <pre>...</pre>
or <syntaxhighlight>...</syntaxhighlight>
. See Help:Wiki markup for an explanation of what the various tags do.
If the content includes an equals sign (=), you must specify the parameter explicitly: {{code|1=date=30 Feb 2010}}
.
The template uses the <syntaxhighlight>
tag with the attribute inline=1
. This works like the combination of the <code>
and <nowiki>
tags, applied to the expanded wikitext. For example, {{code|some '''wiki''' text}}
will not render the word "wiki" in bold, and will render the tripled-single-quotes:
- Template loop detected: Template:Code
However, {{code|a {{template}} call}}
will still invoke the template:
- Template loop detected: Template:Code
Use <nowiki>...</nowiki>
around the template name to avoid this problem:
- Template loop detected: Template:Code
When used inline with regular text, {{code}}
generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:
- Template loop detected: Template:Code
is well spaced:
- foo Template loop detected: Template:Code quux.
versus:
- Template loop detected: Template:Code
which is going to be visually confusing for many:
- foo Template loop detected: Template:Code quux.
because "foo" and "Template loop detected: Template:Code" will seem more closely associated than "Template loop detected: Template:Code" and "Template loop detected: Template:Code"; the width of the space character in a monospaced font is almost always larger than in a proportional font.
Use parameter {{{2}}} (unnamed, as |2=
, or more explicitly as |lang=
) to specify a language for mw:Extension:SyntaxHighlight. This option defaults to plain-text, i.e. no highlighting. There is no highlighting option for wikitext as a markup language, though Template loop detected: Template:Code and Template loop detected: Template:Code are valid values, as are Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code, Template loop detected: Template:Code and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.
This template does not need to be substituted.
Examples
Markup | Renders asScript error: No such module "For loop". |
---|---|
Included templates
Embedded templates do not function as expected inside {{code}}; for longer, free-form blocks of code, which can contain templates such as {{var}} and {{samp}}, use <code>...</code>
as a wrapper instead of this template.
Templates used inside {{code}} expose the rendered HTML— this can be useful. For example:
Markup | Renders asScript error: No such module "For loop". |
---|---|
The above example shows the HTML rendered by the citation template, including the hidden metadata.
TemplateData
TemplateData for Test case
See also
- {{codett}}, wrapper for this template that removes background and border styling
- {{mono}}, monospaced font only
- {{param value}}, monospaced; friendly handling for blank space
- {{Syntaxhighlight}}
- {{kbd}}, for keyboard input
- Help:Wiki markup
|_output=default
.
{{URL}} | → | example.com |
---|---|---|
{{Official website}} | → | example.com |
Nowiki output
A nowiki version of the template's output is displayed when |_output=nowiki
. This is helpful if there are differences in the underlying wikitext which are not visible in the default output.
{{URL}} | → | <span class="url">[https://www.example.com example.com]</span> |
---|---|---|
{{Official website}} | → | <span class="official-website"><span class="url">[https://www.example.com example.com]</span></span> |
Nowiki+ output
Both the default output and nowiki version are displayed when |_output=nowiki+
.
{{URL}} | → |
example.com<span class="url">[https://www.example.com example.com]</span> |
---|---|---|
{{Official website}} | → |
example.com<span class="official-website"><span class="url">[https://www.example.com example.com]</span></span> |
Collapsible test cases
If _collapsible
is set to "y" or "yes", 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. It has the following extra parameters:
Parameter | Description |
---|---|
_title |
Use |_title= to display a custom title for collapsible test cases.
|
_titlecode |
Use |_titlecode=yes to display the template's code as the title of a collapsible test case.
|
_notcollapsed |
If set to y or yes , the test case will always be expanded upon loading the page. If set to n or no , it will always be collapsed upon loading the page. This setting overrides the default functionality in which the test case is collapsed unless two or more outputs do not match.
|
Examples
Default title
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
{{ombox/sandbox}}
Error: expandTemplate: template "ombox/sandbox" does not exist
With _title
{{ombox}} | {{ombox/sandbox}} | ||
---|---|---|---|
| Error: expandTemplate: template "ombox/sandbox" does not exist |
{{ombox}} | ||
| ||
{{ombox/sandbox}} | ||
Error: expandTemplate: template "ombox/sandbox" does not exist |
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
{{tmbox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
With _titlecode=yes
This is useful for templates with a small number of parameters. It displays the template code in the title, eliminating the need for both |_title=
and |_showcode=yes
. For actual tests implemented with |_titlecode=yes
, see Template:URL/testcases.
{{URL}} | → |
www<span class="url">[http://www.example.com www<wbr/>.example<wbr/>.com]</span> |
---|---|---|
{{URL/sandbox}} | → |
Error: expandTemplate: template "URL/sandbox" does not exist<strong class="error">Error: expandTemplate: template "URL/sandbox" does not exist</strong> |
With _notcollapsed=yes
If |_notcollapsed=yes
, the test case will always be expanded upon loading the page. This setting overrides the default functionality in which the test case is collapsed unless two or more outputs do not match. The following example would normally be collapsed, as indicated by green background of title:
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
With _notcollapsed=no
If |_notcollapsed=no
, the test case will always be collapsed upon loading the page. This setting overrides the default functionality in which the test case is collapsed unless two or more outputs do not match. The following would normally be expanded, as indicated by yellow background of title:
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
{{tmbox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. |
Additional examples
With _showcode
- Usage
{{test case|_template1=ombox|_showcode=yes|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}
- Output
{{ombox|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
{{ombox/sandbox}}
Error: expandTemplate: template "ombox/sandbox" does not exist
With _showcode, using a nowiki invocation via _code
- Usage
{{test case|_template1=ombox|_showcode=yes |_code = <nowiki>{{__TEMPLATENAME__ | text = Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. }}</nowiki> |text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. }}
- Output
{{ombox | text = Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. }}
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
{{ombox/sandbox}}
Error: expandTemplate: template "ombox/sandbox" does not exist
With _showcode and _collapsible
- Usage
{{test case|_template1=ombox|_showcode=yes|_collapsible=yes|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}
- Output
{{ombox|text=Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.}}
{{ombox}}
File:Information icon4.svg | Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. |
{{ombox/sandbox}}
Error: expandTemplate: template "ombox/sandbox" does not exist
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.
- When generating the template code used with
|_showcode=
whitespace in named parameters is ignored, numbered parameters like|1=
may be incorrectly displayed as positional parameters, and duplicate parameters are ignored. This is due to how template parameters are processed before they are passed to Module:Template test case. - When using a template invocation inside nowiki tags with the
|_code=
parameter, the HTML entities <, > and " are converted to the literal characters <, > and ". This is due to the way nowiki tags work. - For collapsible test cases, all text inside each extension tag (e.g.
<ref>
,<references>
,<gallery>
or<nowiki>
) is treated as equal. These tags are converted to strip markers before they are passed to the template, and all strip markers include a unique hexadecimal string. 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. all<ref>...</ref>
tags are treated as though they are equal, but should be adequate for most uses.
See also
Templates invoking Module:Template test case:
- Template:Testcase rows – for a table of test cases arranged in rows
- Template:Testcase table – for a table of test cases arranged in columns
- 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
<nowiki>...</nowiki>
tags - Template:Nowiki template demo – for use in template documentation
- Pages with template loops
- Pages with script errors
- Pages with TemplateStyles errors
- Pages with broken file links
- Lua-based templates
- Templates using TemplateData
- Programming typing-aid templates
- Semantic markup templates
- Wikipedia XHTML tag-replacing templates
- Test cases using output parameter
- Talk message boxes
- Template test cases
- Template namespace templates