Module talk:Template test case: Difference between revisions

Content deleted Content added
 
(3 intermediate revisions by 3 users not shown)
Line 326:
 
It would be helpful if this module could be test module output. For example instead of {{para|_template=xyz}} we had something like {{para|_module|xyz}} and {{para|_function|def}} which would pass the arguments to <code><nowiki>{{#invoke:xyz|def|...</nowiki></code> and <code><nowiki>{{#invoke:xyz/sandbox|def|...</nowiki></code> and compare the results &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 21:54, 23 January 2025 (UTC)
 
:@[[User:Aidan9382|Aidan9382]]: are you familiar with this module? &mdash;&nbsp;Martin <small>([[User:MSGJ|MSGJ]]&nbsp;·&nbsp;[[User talk:MSGJ|talk]])</small> 09:53, 18 February 2025 (UTC)
::From a quick read of the documentation, it seems to be possible to force a module test if you use {{tl|Test case nowiki}}, e.g. <syntaxhighlight lang=wikitext inline>{{Test case nowiki|template=Disambiguation|heading1=[[Module:Disambiguation]]|heading2=[[Module:Disambiguation/sandbox]]|<nowiki>{{#invoke:__TEMPLATENAME__|isDisambiguationPage|Paris}}</nowiki>}}</syntaxhighlight>. The headers it normally provides will form template links instead of module links, so you have to specify the headers manually. A little hacky, but that's at least a way you can do it right now. [[User:Aidan9382|Aidan9382]] <sub>([[User talk:Aidan9382|talk]])</sub> 11:20, 18 February 2025 (UTC)
 
== Similar module with known answer rather than live v. sandbox==
 
This module compares the live result to the production result. I'm interested in comparing the live result, production result, or both to a known good result. For example, I'm testing date-related templates. I have a book with a list of information about dates, such as the Gregorian calendar date, Julian calendar date, [[Julian day]], and day of the week. I'd like to compare the result from a template to what this book says the result should be.
 
Any suggestions? [[User:Jc3s5h|Jc3s5h]] ([[User talk:Jc3s5h|talk]]) 11:53, 18 March 2025 (UTC)
 
== _showcode and templates in parameter values? ==
 
Using another template in the tested template parameters, like this:
{{demo|sep=produces
|<nowiki>{{test case |_showcode=1 |_template=tq |_template2=!tq
|1=parameter {{nobr|with a}} template }}
</nowiki>}}
That is, the inner template is substituted before showing the code. Can this be avoided somehow (without duplicating the whole set of parameters in <code><nowiki>_code=&lt;nowiki>{{__TEMPLATENAME__|...}}&lt;/nowiki></nowiki></code>)? — [[User:Mikhail Ryazanov|Mikhail Ryazanov]] ([[User talk:Mikhail Ryazanov|talk]]) 23:10, 6 June 2025 (UTC)