Module:Params/testcases: Difference between revisions

Content deleted Content added
mNo edit summary
See also: limit
 
(29 intermediate revisions by 2 users not shown)
Line 1:
This[[File:Gelemental.svg|thumb|Here isare thesome testcases pagetools for testing the{{ml|params|}} behaviour ofand [[Module:Params/sandbox|its sandbox version]].]]
 
This is the [[Wikipedia:Template sandbox and test cases|testcases]] page for checking the behaviour of [[Module:Params]].
As the module provides most of its functionalities only when called by templates, this page uses helper subtemplates to do its tests. You can find a list of these [[Special:PrefixIndex/Module:Params/testcases/|here]].
 
As the module provides most of its functionalities only when called by templates, this page uses helper subtemplates to do its tests. You can find a complete list of these [[Special:PrefixIndex/Module:Params/testcases/|here]]. Several helper subtemplates come in two versions, one that depends on {{ml|params|}} and one that depends on {{ml|params/sandbox|}}. Example templates, used by the documentation page, are available at [[Module:Params/doc/examples|/doc/examples]].
 
== General tests ==
 
==== Helper subtemplate {{[[Module:Params/testcases/multitdelimiters|./multitdelimiters]]}} ====
=== Multi-purpose helper subtemplates ===
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,
 
<syntaxhighlight lang="wikitext">{{module:params/testcases/tdelimiters|foo|bar|Jupiter|hello=world}}</syntaxhighlight>
==== Helper subtemplate {{[[Module:Params/testcases/multi|./multi]]}} ====
The {{[[Module:Params/testcases/multi|./multi]]}} 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.
 
generates
For instance, writing
 
<syntaxhighlight lang="wikitext">{{module:params/testcases/multitdelimiters|foo|bar|Jupiter|hello=world}}
setting|i/p|<br />|: |list|
-|hello|world|foo=bar}}</syntaxhighlight>
 
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tdelimiters sandbox|./tdelimiters sandbox]]}}.
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:
 
==== Helper subtemplate {{[[Module:Params/testcases/print1tnumerical|./print1tnumerical]]}} ====
{{module:params/testcases/multi|
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,
setting|i/p|<br />|: |list|
-|hello|world|foo=bar}}
 
<syntaxhighlight lang="wikitext">{{module:params/testcases/tnumerical
=== Miscellaneous helper subtemplates ===
| #first = 2
| #second = 2
| -2 = minus two
| 0 = zero
| 1 = one
| 2 = two
| 3 = three
| 19 = nineteen
| 20 = twenty
-|hello|world|foo=bar}}</syntaxhighlight>
 
generates
==== Helper subtemplate {{[[Module:Params/testcases/print1|./print1]]}} ====
The {{[[Module:Params/testcases/print1|./print1]]}} subtemplate only echoes the first unnamed parameter passed and discards the others (i.e. simply {{param|1|}}).
 
{{module:params/testcases/multi|tnumerical
== Testing single functions ==
| #first = 2
| #second = 2
| -2 = minus two
| 0 = zero
| 1 = one
| 2 = two
| 3 = three
| 19 = nineteen
| 20 = twenty
}}
 
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tnumerical sandbox|./tnumerical sandbox]]}}.
=== Testing the <code>[[Module:Params#list|list]]</code> function ===
 
==== Helper subtemplate {{[[Module:Params/testcases/echotmaps|./echotmaps]]}} ====
The {{[[Module:Params/testcases/echotmaps|./echotmaps]]}} subtemplate callsallows theto {{mfl|params|list}}test functionthe tobehaviour echoof 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 itvisit wasits calleddocumentation withpage.
 
{{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,
 
<syntaxhighlight lang="wikitext">{{ module:params/testcases/tcompare separated entries | one | two | three | foo | bar | Jupiter | hello = world }}</syntaxhighlight>
 
generates
 
{{ module:params/testcases/tcompare separated entries | one | two | three | foo | bar | Jupiter | hello = world }}
 
=== Helper subtemplate {{[[Module:Params/testcases/tcoins|./tcoins]]}} ===
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">{{Module:Params/testcases/tcoins|foo|hello|2|3|foo}}</syntaxhighlight>
 
generates
 
{{module:params/testcases/tcoins|foo|hello|2|3|foo}}
 
{{A note}} An identical subtemplate that uses [[Module:Params/sandbox]] instead of [[Module:Params]] is available at {{[[Module:Params/testcases/tcoins sandbox|./tcoins sandbox]]}}.
 
== Testing singleindividual 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.
 
Example:
 
{{Automarkup|{{Make code|<<module:params/testcases/echotecho!hello!world!foo{{=}}bar>>}}}}
 
== Dummies ==
* Dummy submodules
** {{mlmfl|params/testcases/mdummy|echo sb}}
* 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}}
* {{sl|all: contentmodel:wikitext hastemplate:module:params insource:/\#[Ii][Nn][Vv][Oo][Kk][Ee] *: *[Pp]arams *\{{!}}/|Extensive “in source” search|limit=500}}.
 
[[Category:Module test cases]]