ਸਮੱਗਰੀ 'ਤੇ ਜਾਓ

ਫਰਮਾ:Testcase/doc

ਵਿਕੀਪੀਡੀਆ, ਇੱਕ ਆਜ਼ਾਦ ਵਿਸ਼ਵਕੋਸ਼ ਤੋਂ

Use to compare a template with its sandbox. Pass the raw code in nowikis as the first unnamed parameter; the existing template as the second, and the sandbox as the third. The optional named parameter |id= is used as a heading (to describe the test being performed); if |id= is omitted, parameter 1 is used. The optional named parameter |layout= determines whether the live and sandbox outputs are displayed side by side or on top of each other. The default value is vertical (on top of each other). A value of horizontal will produce side by side output.

If the pair of test codes in parameters 2 and 3 both produce the same output, then the test case is displayed in a collapsed table with a green heading. If the test codes produce different output (this includes white space differences), then the test is displayed in an uncollapsed table with a yellow heading.

Note that some more complex templates may cause testcases to be highlighted even when their output is the same. The cause of this is under investigation...

Example

[ਸੋਧੋ]
{{testcase
|id=title and url
|layout=horizontal
|<nowiki>{{citation|title=Test|url=http://example.org}}</nowiki>
|{{citation        |title=Test|url=http://example.org}}
|{{citation/sandbox|title=Test|url=http://example.org}}
}}

If the sandbox code in parameter 3 gives the same output as the non-sandbox code in parameter 2:

title and url
{{citation|title=Test|url=http://example.org}}
Test
Test
Expanded code
'"`UNIQ--templatestyles-00000005-QINU`"'<cite class="citation cs2">[http://example.org ''Test'']</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Test&rft_id=http%3A%2F%2Fexample.org&rfr_id=info%3Asid%2Fpa.wikipedia.org%3A%E0%A8%AB%E0%A8%B0%E0%A8%AE%E0%A8%BE%3ATestcase%2Fdoc" class="Z3988"></span>
'"`UNIQ--templatestyles-00000007-QINU`"'<cite class="citation cs2">[http://example.org ''Test'']</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Test&rft_id=http%3A%2F%2Fexample.org&rfr_id=info%3Asid%2Fpa.wikipedia.org%3A%E0%A8%AB%E0%A8%B0%E0%A8%AE%E0%A8%BE%3ATestcase%2Fdoc" class="Z3988"></span>

If sandbox gives different output:

title and url
{{citation|title=Test|url=http://example.org}}
Test
Test content of the differing output
Expanded code
'"`UNIQ--templatestyles-0000000B-QINU`"'<cite class="citation cs2">[http://example.org ''Test'']</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Test&rft_id=http%3A%2F%2Fexample.org&rfr_id=info%3Asid%2Fpa.wikipedia.org%3A%E0%A8%AB%E0%A8%B0%E0%A8%AE%E0%A8%BE%3ATestcase%2Fdoc" class="Z3988"></span>
'"`UNIQ--templatestyles-0000000C-QINU`"'<cite class="citation cs2">[http://example.org ''Test'']</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Test&rft_id=http%3A%2F%2Fexample.org&rfr_id=info%3Asid%2Fpa.wikipedia.org%3A%E0%A8%AB%E0%A8%B0%E0%A8%AE%E0%A8%BE%3ATestcase%2Fdoc" class="Z3988"></span> content of the differing output

See also

[ਸੋਧੋ]

Templates invoking Module:Template test case: