Module:Params/testcases: Difference between revisions

Content deleted Content added
See also: Add internal link
See also: limit
 
(10 intermediate revisions by 2 users not shown)
Line 7:
== General tests ==
 
==== Helper subtemplate {{[[Module:Params/testcases/tdelimiters|./tdelimiters]]}} ====
=== Multi-purpose helper subtemplates ===
 
==== Helper subtemplate {{[[Module:Params/testcases/tmulti|./tmulti]]}} ====
The {{[[Module:Params/testcases/tmulti|./tmulti]]}} subtemplate allows to simulate in one single call both the incoming parameters and the parameters manually concatenated to <code>{{ml|params|...|''function''|...}}</code>, using a single hyphen (<code>-</code>) as a delimiter between the two groups. This allows to make general experiments directly from the preview window without having to edit separate templates.
 
For instance, writing
 
<syntaxhighlight lang="wikitext">{{module:params/testcases/tmulti|
setting|i/p|<br />|: |list|
-|hello|world|foo=bar}}</syntaxhighlight>
 
will simulate a call with {{para|1|hello}}, {{para|2|world}}, and {{para|foo|bar}} to a template whose content is <syntaxhighlight lang="wikitext" inline>{{#invoke:params|setting|i/p|<br />|: |list}}</syntaxhighlight>, thus producing:
 
{{module:params/testcases/tmulti|
setting|i/p|<br />|: |list|
-|hello|world|foo=bar}}
 
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tmulti sandbox|./tmulti sandbox]]}}.
 
=== Single-purpose helper subtemplates ===
 
==== Helper subtemplate {{[[Module:Params/testcases/tdelimiters|./tdelimiters]]}} ====
The {{[[Module:Params/testcases/tdelimiters|./tdelimiters]]}} subtemplate allows to test the behaviour of delimiter strings between the arguments it was called with, invoking several functions of the module at once. For instance,
 
Line 39 ⟶ 18:
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tdelimiters sandbox|./tdelimiters sandbox]]}}.
 
==== Helper subtemplate {{[[Module:Params/testcases/tnumerical|./tnumerical]]}} ====
The {{[[Module:Params/testcases/tnumerical|./tnumerical]]}} subtemplate allows to test the behaviour of functions that focus on numerical and sequential arguments. As these require at most two arguments, the template uses the {{para|&#35;first}} and {{para|&#35;second}} special parameters to do its tests. For instance,
 
Line 70 ⟶ 49:
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tnumerical sandbox|./tnumerical sandbox]]}}.
 
==== Helper subtemplate {{[[Module:Params/testcases/tmaps|./tmaps]]}} ====
The {{[[Module:Params/testcases/tmaps|./tmaps]]}} subtemplate allows to test the behaviour of all the <code>mapping_*</code> and <code>renaming_*</code> class of modifiers. As the template generates a very large page its expansion is not shown here. For more information please visit its documentation page.
 
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tmaps sandbox|./tmaps sandbox]]}}.
 
==== Helper subtemplate {{[[Module:Params/testcases/tcompare separated entries|./tcompare separated entries]]}} ====
The {{[[Module:Params/testcases/tcompare separated entries|./tcompare separated entries]]}} subtemplate compares the behaviours of [[Module:Params]] with that of [[Module:Separated entries]]. For instance,
 
Line 84 ⟶ 63:
{{ module:params/testcases/tcompare separated entries | one | two | three | foo | bar | Jupiter | hello = world }}
 
==== Helper subtemplate {{[[Module:Params/testcases/tmultitcoins|./tmultitcoins]]}} ====
== Testing individual functions ==
The {{[[Module:Params/testcases/tcoins|./tcoins]]}} subtemplate allows to experiment with the <code>[[Module:Params#coins|coins]]</code> and <code>[[Module:Params#unique_coins|unique_coins]]</code> functions, which are called with the following arguments: <syntaxhighlight lang="wikitext" inline>one|two|three|foo=bar|hello=world</syntaxhighlight>. Therefore, transcluding the template with,
 
<syntaxhighlight lang="wikitext">{{moduleModule:paramsParams/testcases/tmultitcoins|foo|hello|2|3|foo}}</syntaxhighlight>
 
generates
 
{{module:params/testcases/tmultitcoins|foo|hello|2|3|foo}}
=== Testing the <code>[[Module:Params#list|list]]</code> function ===
 
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tmultitcoins sandbox|./tmultitcoins sandbox]]}}.
 
== Testing individual functions ==
 
==== Helper subtemplate {{[[Module:Params/testcases/techo|./techo]]}} ====
The {{[[Module:Params/testcases/techo|./techo]]}} subtemplate calls the {{mfl|params|list}} function to echo the code it was called with.
 
Line 100 ⟶ 88:
* Dummy subtemplates
** {{[[module:params/testcases/tdummy echo sb]]}}
 
== Deprecated tools ==
The following tools were developed with older versions of [[Module:Params]] in mind, and were later superseded by new functionalities in the module. They are kept here for historical reasons.
 
* {{[[Module:Params/testcases/tmulti|./tmulti]]}} and {{[[Module:Params/testcases/tmulti sandbox|./tmulti sandbox]]}}
 
== See also ==
* [[Module:Params/ChangeLog|ChangeLog of Module:Params]]
* [[{{rel|Module:Params/doc/examples|/doc/examples]]}}
* {{sl|all: contentmodel:wikitext hastemplate:module:params insource:/\#[Ii][Nn][Vv][Oo][Kk][Ee] *: *[Pp]arams *\{{!}}/|Extensive “in source” search|limit=500}}.
* <span class="plainlinks">[//en.wikipedia.org/w/index.php?title=Special:Search&limit=500&offset=0&ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns100=1&ns101=1&ns118=1&ns119=1&ns710=1&ns711=1&ns829=1&search=insource%3A%2Finvoke%3Aparams%2F Extensive “in source” search]</span>.
 
[[Category:Module test cases]]