Module talk:Template test case

This is an old revision of this page, as edited by Andrybak (talk | contribs) at 22:25, 9 July 2020 (Something just changed: expand the test). 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 Andrybak in topic Something just changed

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 description !! Template call 
! {{tl|frac}} !! {{tl|frac/sandbox}} !! {{tl|sfrac}} !! {{tl|sfrac/sandbox}}
|-
{{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}}
|}

Hyphen issue in Template:Test case nowiki

This came up when I was working on Template:Graphical timeline/testcases. At Special:Permalink/958740301 it can be observed that parameter |note3-at= gets a broken value. First character, hyphen, is correct, however, the first opening brace { of {{Period start}} is converted into an HTML entity for some reason. This results in an error Expression error: Unrecognized punctuation character "&" somewhere deep inside the template's internals. I've added a test case to demonstrate the issue on a smaller example. —⁠andrybak (talk) 13:38, 25 May 2020 (UTC)Reply

See phab:T168759 * Pppery * it has begun... 20:45, 25 May 2020 (UTC)Reply

Something just changed

From yesterday to today, the boxes at Template:Spoken Wikipedia/testcases changed from yellow to green, became collapsed, and introduced an error where they now don't seem to be able to embed audio files properly. I'm not sure where the edit that caused this was made, though. Does anyone know? {{u|Sdkb}}talk 21:20, 9 July 2020 (UTC)Reply

Sdkb, user Izno has responded to the edit request. That would explain the change from yellow to green on /testcases. Templates {{Spoken Wikipedia}} and {{Spoken Wikipedia/sandbox}} now produce the same output. Audio player is also broken for me. —⁠andrybak (talk) 22:13, 9 July 2020 (UTC)Reply
I've changed the output of /sandbox, and the audio players are now fixed. Perhaps the player doesn't survive in a collapsed state? —⁠andrybak (talk) 22:17, 9 July 2020 (UTC)Reply
Andrybak, hmm, interesting. I just checked a few live instances, and it's not causing any problems there. {{u|Sdkb}}talk 22:18, 9 July 2020 (UTC)Reply
(edit conflict)
Tests for media player
Collapsed Not collapsed
Audio player inside

Vide player inside

Audio player is broken, but video is fine. —⁠andrybak (talk) 22:18, 9 July 2020 (UTC)Reply

Sdkb, I suggest to move this discussion to WP:VPT. Module:Template test case is not at fault, it's wider issue. —⁠andrybak (talk) 22:23, 9 July 2020 (UTC)Reply