Module:Params/testcases
This is the testcases page for testing 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 here.
General tests
Multi-purpose helper subtemplates
Helper subtemplate {{./multi}}
The {{./multi}} subtemplate allows to simulate in one single call both the incoming parameters and the parameters possibly concatenated to {{#invoke:params|...|function|...}}
, using a single hyphen (-
) as a separator between the two groups. This allows to perform generic tests without having to create test templates.
For instance, writing
{{Module:Params/testcases/multi|
setting|i/p|<br />|: |list|
-|hello|world|foo=bar}}
will simulate a call with |1=hello
, |2=world
, and |foo=bar
to a template whose content is {{#invoke:params|setting|i/p|<br />|: |list}}
, thus producing:
Miscellaneous helper subtemplates
Helper subtemplate {{./print1}}
The {{./print1}} subtemplate only echoes the first unnamed parameter passed and discards the others (i.e. simply {{{1|}}}
).
Testing single functions
Testing the list
function
Helper subtemplate {{./echo}}
The {{./echo}} subtemplate calls the {{#invoke:params|list}} function to echo the code it was called with.
Example:
Markup | Renders as |
---|---|
{{Module:Params/testcases/echo|hello|world|foo=bar}} |
|