Module talk:Template test case

This is an old revision of this page, as edited by Crissov (talk | contribs) at 10:23, 1 January 2020 (Table with many tests). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Latest comment: 5 years ago by Crissov in topic Table with many tests

Multiple automatic sandbox versions

Can we please extend the automatic addition of a /sandbox variant to all _templateis if there is no _template++i? — Christoph Päper 11:14, 20 September 2019 (UTC)Reply

Table with many tests

For some templates, especially inline templates like {{frac}}, it makes sense to have all or most test cases in a single table with one combination of parameters per row. It would be nice if this could be handled by a single function call by passing multiple parameter sets, e.g.:

{{test case|_template1=frac|_template3=sfrac
|_test1={1}      |_label1=single anonymous parameter, numeric
|_test2={1,2}    |_label2=two anonymous parameters, all numeric
|_test3={1,2,3}  |_label3=three anonymous parameters, all numeric
|_test4={1=1}    |_label4=single, first parameter
|_test5={2=1}    |_label5=single, second parameter
|_test6={3=1}    |_label6=single, third parameter
|_test7={1,3=2}  |_label7=first and third parameter
|_test8={2=1,3=2}|_label8=second and third parameter
|_test9={a}      |_label9=single anonymous parameter, alphabetic
|_test10={1,1}   |_label10=two equal parameters
}}

11:14, 20 September 2019 (UTC)

Alternatively, there should be an additional rendering mode cells. It would put the code and each result for all templates and sandbox versions into adjacent cells in a single table row, but the user would have to provide the surrounding table code (but possibly not the rows |-). — Christoph Päper 10:16, 1 January 2020 (UTC)Reply
{| class="wikitable sortable"
|+ Test cases
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|_label=single anonymous parameter, numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|2|_label=two anonymous parameters, all numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|2|3|_label=three anonymous parameters, all numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1=1|_label=single, first parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|2=1|_label=single, second parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|3=1|_label=single, third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|3=2|_label=first and third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|2=1|3=2|_label=second and third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|a|_label=single anonymous parameter, alphabetic}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|1|_label=two equal parameters}}
|}