![]() | To help centralise discussions and keep related topics together, the following pages redirect here: |
![]() |
![]() | Templates | |||
|
Can we please extend the automatic addition of a /sandbox
variant to all _templatei
s if there is no _template++i
?
—
Christoph
Päper
11:14, 20 September 2019 (UTC)
For some templates, especially inline templates like {{ frac}}, it makes sense to have all or most test cases in a single table with one combination of parameters per row. It would be nice if this could be handled by a single function call by passing multiple parameter sets, e.g.:
{{test case|_template1=frac|_template3=sfrac
|_test1={1} |_label1=single anonymous parameter, numeric
|_test2={1,2} |_label2=two anonymous parameters, all numeric
|_test3={1,2,3} |_label3=three anonymous parameters, all numeric
|_test4={1=1} |_label4=single, first parameter
|_test5={2=1} |_label5=single, second parameter
|_test6={3=1} |_label6=single, third parameter
|_test7={1,3=2} |_label7=first and third parameter
|_test8={2=1,3=2}|_label8=second and third parameter
|_test9={a} |_label9=single anonymous parameter, alphabetic
|_test10={1,1} |_label10=two equal parameters
}}
11:14, 20 September 2019 (UTC)
|-
). —
Christoph
Päper
10:16, 1 January 2020 (UTC){| class="wikitable sortable"
|+ Test cases
|-
! Test case description !! Template call
! {{tl|frac}} !! {{tl|frac/sandbox}} !! {{tl|sfrac}} !! {{tl|sfrac/sandbox}}
|-
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|_label=single anonymous parameter, numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|2|_label=two anonymous parameters, all numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|2|3|_label=three anonymous parameters, all numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1=1|_label=single, first parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|2=1|_label=single, second parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|3=1|_label=single, third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|3=2|_label=first and third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|2=1|3=2|_label=second and third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|a|_label=single anonymous parameter, alphabetic}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|1|_label=two equal parameters}}
|}
This came up when I was working on
Template:Graphical timeline/testcases. At
Special:Permalink/958740301 it can be observed that parameter |note3-at=
gets a broken value. First character, hyphen, is correct, however, the first opening brace { of {{Period start}}
is converted into an
HTML entity for some reason. This results in an error Expression error: Unrecognized punctuation character "&"
somewhere deep inside the template's internals. I've added
a test case to demonstrate the issue on a smaller example. —
andrybak (
talk)
13:38, 25 May 2020 (UTC)
From yesterday to today, the boxes at Template:Spoken Wikipedia/testcases changed from yellow to green, became collapsed, and introduced an error where they now don't seem to be able to embed audio files properly. I'm not sure where the edit that caused this was made, though. Does anyone know? {{u| Sdkb}} talk 21:20, 9 July 2020 (UTC)
Collapsed | Not collapsed | ||
---|---|---|---|
|
| ||
|
|
Audio player is broken, but video is fine. — andrybak ( talk) 22:18, 9 July 2020 (UTC)
I looked through the documentation, but I was unable to find a way to specify the page name (magic word PAGENAME) in a template test case. For templates that use Wikidata calls, for example, the Wikidata call checks the PAGENAME and retrieves the appropriate bit of data from the corresponding Wikidata page. Is there a way to do this? The result would be to render the template as it would appear when processed by Special:ExpandTemplates with the appropriate PAGENAME entered in the upper text field. – Jonesey95 ( talk) 22:55, 23 July 2020 (UTC)
|qid=
in your infobox. See
Template:Ordination/testcases for an example. –
Jonesey95 (
talk)
01:23, 3 August 2020 (UTC)This is probably something silly I am doing, but I can't figure out what. I am using {{ inline test case}} in the testcase page of Template:Cite certification and from some reason I am sometimes (rarely) getting an extra paragraph break between results. I created an example: Template:Cite certification/testcases-example. I was worried that there is something wrong with the {{ Cite certification}}, but as you can see from the code in the example, the paragraph break does not appear when running either the stable or the (identical) sandbox versions. Any ideas? -- Muhandes ( talk) 14:46, 31 December 2020 (UTC)
I'd like the ability to use a second sandbox, say, 'sandbox2', to enable simultaneous testing of different sets of changes in parallel tracks for the same template. Having browsed Module:Template test case, I believe a better method is available than the obvious brute force method of duplicating template FOO to FOO2, then FOO2/sandbox, and testcases to FOO2/testcases. Afaict the key seems to have something to do with wrapperConfig unless I'm mistaken, only I don't see how to use it, and the /doc doesn't have much to say about it.
This use case comes up occasionally in RL on complex templates that may need extended testing of some feature, while someone else desires to test another feature, or where different scenarios are being tried out. (For a RW case of the former type see Template talk:Find sources#Missing redirect detection bug.) I get the feeling I can just create Template:Find sources/sandbox2 with my changes, and then create a "wrapper config" somewhere, and set it as param2 to the invoke.
For example, can I just duplicate
Module:Template test case/config to Template:Find general sources/MySandbox2Config, edit it to set sandboxSubpage = 'sandbox2',
and then in Template:Find general sources/sandbox2 invoke like this: {{#invoke:Find sources|Find general sources, MySandbox2Config}}
? Or am I misconstruing how this is supposed to work, and I should go back to the brute force method? Or something else? Pinging @
Mr. Stradivarius and
Trialpears:.
Either way, param2 of the module appears to be a config of some kind, so whether my assumptions above are right or wrong, it would be nice if someone could add a == Params ==
section to
Module:Template test case/doc to describe what this param is and how to use it. (please
mention me on reply; thanks!)
Mathglot (
talk)
22:28, 25 December 2021 (UTC)
|_template1=
, |_template2=
and |_template3=
arguments. For example, {{test case|_template1=Find sources|_template2=Find sources/sandbox|_template3=Find sources/sandbox2|Foo}}
outputs the following:{{test case|_template1=Find sources|_template2=Find sources/sandbox|_template3=Find sources/sandbox2|Foo}}
|_template1=
and |_template2=
arguments, and just specify |_template3=Find sources/sandbox2
to get the same results. —
Mr. Stradivarius
♪ talk ♪
01:17, 26 December 2021 (UTC)
I've a bunch of test cases for a template that takes lots of complicated parameters, but whose output is a relatively short text. Think {{
cite book}} and you're in the ballpark. I want to see the code up top in a nowiki block like {{
test case nowiki|format=columns}}
or |format=rows
gives me, but I'd like to see the output arranged vertically like {{
test case nowiki|format=inline}}
gives me.
Something like:
Example of desired output
|
---|
|
Any takers? Mr. Stradivarius? -- Xover ( talk) 08:45, 13 January 2023 (UTC)
|_format=
? –
Jonesey95 (
talk) 22:26, 14 January 2023
{{code|foo}}
foo
foo
I'm trying to use the |_before=
parameter, mostly to have something to hange templates that create superscript references, tags, and that sort of thing, so they don't appear to be isolated in space. What I'd like to see in this example, is something like this:
Here's my test case, using |_before=
:
{{ Citation needed}}
Some text to hang a tag on. citation needed
Some text to hang a tag on. citation needed
Am I doing something wrong, here? Why isn't it echoing the "before" text? Mathglot ( talk) 04:29, 26 January 2023 (UTC)
@ Frietjes, re this edit, should we make some change to {{ Test case}} to better handle instances when it's used when there's no sandbox? {{u| Sdkb}} talk 19:42, 19 May 2023 (UTC)
I've changed the <code>...</code>
tags to <syntaxhighlight>...</syntaxhighlight>
tags when |_showcode=
is used.
Sandbox and
Diff.
Gonnym (
talk)
18:04, 23 May 2023 (UTC)
|format=syntaxhighlight
(and/or |format=syntax
maybe) instead? Are there any weird border cases where <code><nowiki>...</nowiki>
</code>
works, but <syntaxhighlight lang="mediawiki" inline>...</syntaxhighlight>
might break?
FeRDNYC (
talk)
04:00, 15 July 2023 (UTC)So, in most of the test case templates, you pass arguments to the test-case code preceded by underscores, and actual arguments to the template being tested are passed as usual, e.g.:
{{Test case|_collapsible=yes|_showcode=yes|_title=Some test case
|_template1=Code
|1=wikitable
}}
OK, great. But then here comes {{
Test case nowiki}}
, where the underscore arguments don't work, and you have to use non-underscored ones:
{{Test case nowiki|_collapsible=yes|_showcode=yes|_title=Some test case
|_template1=Code
|<nowiki>{{__TEMPLATENAME__
|1=wikitable}}</nowiki>
}}
{{Test case nowiki|collapsible=yes|showcode=yes|title=Some test case
|template1=Code
|<nowiki>{{__TEMPLATENAME__
|1=wikitable}}</nowiki>
}}
My question is, why??? If these templates are a "family", and so often used together, doesn't it make sense for {{
Test case nowiki}}
to take the same set of arguments that {{
Test case}}
and all the others take? Even if it's not strictly necessary for them to be preceded by underscores? It would make converting test cases between the non-nowiki and nowiki versions a lot quicker and more convenient. Am I really the only person who finds themselves doing that pretty frequently?
FeRDNYC (
talk)
06:33, 15 July 2023 (UTC)
{{
Test case nowiki}}
can do without them. But in the interests of... I don't know, consistency, harmony, whatever, it seems like bridge.nowiki
could include this logic: local options = {}
for k, v in pairs(args) do
local underscoreOptionKey = type(k) == 'string' and k:match('^_(.*)$')
if underscoreOptionKey then
optionsunderscoreOptionKey = v
else
optionsk = v
end
end
local code = options.code or options1
local invocationObj = NowikiInvocation.new(code, cfg)
options.code = nil
options1 = nil
-- Assume we want to see the code as we already passed it in.
options.showcode = options.showcode or true
local testCaseObj = TestCase.new(invocationObj, options, cfg)
|_collapsible=
and |collapsible=
are equivalent, meaning the user has the option to pass the exact same arguments as all the other templates in the group.
FeRDNYC (
talk)
18:44, 15 July 2023 (UTC)
It is also odd that this module appears in "Pages transcluded onto the current version of this page" when you edit the testcases page- that part makes sense, since {{ Test case}} uses this module, as does {{ Test case nowiki}} and a couple of the other related templates. As for why it took editing this for it to appear in an error report, even I'm not sure on that one. It definitely didn't change the behaviour, so maybe this change just caused it to purge and appear in the report. Could the report have had a recent change on what it picks up? Aidan9382 ( talk) 13:00, 17 July 2023 (UTC)
![]() | This
edit request to
Module:Template test case/config has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please, remove the n of the word templaten in the line number 29. Nishimoto, Gilberto Kiyoshi ( talk) 16:38, 17 October 2023 (UTC)
![]() | To help centralise discussions and keep related topics together, the following pages redirect here: |
![]() |
![]() | Templates | |||
|
Can we please extend the automatic addition of a /sandbox
variant to all _templatei
s if there is no _template++i
?
—
Christoph
Päper
11:14, 20 September 2019 (UTC)
For some templates, especially inline templates like {{ frac}}, it makes sense to have all or most test cases in a single table with one combination of parameters per row. It would be nice if this could be handled by a single function call by passing multiple parameter sets, e.g.:
{{test case|_template1=frac|_template3=sfrac
|_test1={1} |_label1=single anonymous parameter, numeric
|_test2={1,2} |_label2=two anonymous parameters, all numeric
|_test3={1,2,3} |_label3=three anonymous parameters, all numeric
|_test4={1=1} |_label4=single, first parameter
|_test5={2=1} |_label5=single, second parameter
|_test6={3=1} |_label6=single, third parameter
|_test7={1,3=2} |_label7=first and third parameter
|_test8={2=1,3=2}|_label8=second and third parameter
|_test9={a} |_label9=single anonymous parameter, alphabetic
|_test10={1,1} |_label10=two equal parameters
}}
11:14, 20 September 2019 (UTC)
|-
). —
Christoph
Päper
10:16, 1 January 2020 (UTC){| class="wikitable sortable"
|+ Test cases
|-
! Test case description !! Template call
! {{tl|frac}} !! {{tl|frac/sandbox}} !! {{tl|sfrac}} !! {{tl|sfrac/sandbox}}
|-
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|_label=single anonymous parameter, numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|2|_label=two anonymous parameters, all numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|2|3|_label=three anonymous parameters, all numeric}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1=1|_label=single, first parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|2=1|_label=single, second parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|3=1|_label=single, third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|3=2|_label=first and third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|2=1|3=2|_label=second and third parameter}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|a|_label=single anonymous parameter, alphabetic}}
{{test case|_format=cells|_template1=frac|_template3=sfrac|1|1|_label=two equal parameters}}
|}
This came up when I was working on
Template:Graphical timeline/testcases. At
Special:Permalink/958740301 it can be observed that parameter |note3-at=
gets a broken value. First character, hyphen, is correct, however, the first opening brace { of {{Period start}}
is converted into an
HTML entity for some reason. This results in an error Expression error: Unrecognized punctuation character "&"
somewhere deep inside the template's internals. I've added
a test case to demonstrate the issue on a smaller example. —
andrybak (
talk)
13:38, 25 May 2020 (UTC)
From yesterday to today, the boxes at Template:Spoken Wikipedia/testcases changed from yellow to green, became collapsed, and introduced an error where they now don't seem to be able to embed audio files properly. I'm not sure where the edit that caused this was made, though. Does anyone know? {{u| Sdkb}} talk 21:20, 9 July 2020 (UTC)
Collapsed | Not collapsed | ||
---|---|---|---|
|
| ||
|
|
Audio player is broken, but video is fine. — andrybak ( talk) 22:18, 9 July 2020 (UTC)
I looked through the documentation, but I was unable to find a way to specify the page name (magic word PAGENAME) in a template test case. For templates that use Wikidata calls, for example, the Wikidata call checks the PAGENAME and retrieves the appropriate bit of data from the corresponding Wikidata page. Is there a way to do this? The result would be to render the template as it would appear when processed by Special:ExpandTemplates with the appropriate PAGENAME entered in the upper text field. – Jonesey95 ( talk) 22:55, 23 July 2020 (UTC)
|qid=
in your infobox. See
Template:Ordination/testcases for an example. –
Jonesey95 (
talk)
01:23, 3 August 2020 (UTC)This is probably something silly I am doing, but I can't figure out what. I am using {{ inline test case}} in the testcase page of Template:Cite certification and from some reason I am sometimes (rarely) getting an extra paragraph break between results. I created an example: Template:Cite certification/testcases-example. I was worried that there is something wrong with the {{ Cite certification}}, but as you can see from the code in the example, the paragraph break does not appear when running either the stable or the (identical) sandbox versions. Any ideas? -- Muhandes ( talk) 14:46, 31 December 2020 (UTC)
I'd like the ability to use a second sandbox, say, 'sandbox2', to enable simultaneous testing of different sets of changes in parallel tracks for the same template. Having browsed Module:Template test case, I believe a better method is available than the obvious brute force method of duplicating template FOO to FOO2, then FOO2/sandbox, and testcases to FOO2/testcases. Afaict the key seems to have something to do with wrapperConfig unless I'm mistaken, only I don't see how to use it, and the /doc doesn't have much to say about it.
This use case comes up occasionally in RL on complex templates that may need extended testing of some feature, while someone else desires to test another feature, or where different scenarios are being tried out. (For a RW case of the former type see Template talk:Find sources#Missing redirect detection bug.) I get the feeling I can just create Template:Find sources/sandbox2 with my changes, and then create a "wrapper config" somewhere, and set it as param2 to the invoke.
For example, can I just duplicate
Module:Template test case/config to Template:Find general sources/MySandbox2Config, edit it to set sandboxSubpage = 'sandbox2',
and then in Template:Find general sources/sandbox2 invoke like this: {{#invoke:Find sources|Find general sources, MySandbox2Config}}
? Or am I misconstruing how this is supposed to work, and I should go back to the brute force method? Or something else? Pinging @
Mr. Stradivarius and
Trialpears:.
Either way, param2 of the module appears to be a config of some kind, so whether my assumptions above are right or wrong, it would be nice if someone could add a == Params ==
section to
Module:Template test case/doc to describe what this param is and how to use it. (please
mention me on reply; thanks!)
Mathglot (
talk)
22:28, 25 December 2021 (UTC)
|_template1=
, |_template2=
and |_template3=
arguments. For example, {{test case|_template1=Find sources|_template2=Find sources/sandbox|_template3=Find sources/sandbox2|Foo}}
outputs the following:{{test case|_template1=Find sources|_template2=Find sources/sandbox|_template3=Find sources/sandbox2|Foo}}
|_template1=
and |_template2=
arguments, and just specify |_template3=Find sources/sandbox2
to get the same results. —
Mr. Stradivarius
♪ talk ♪
01:17, 26 December 2021 (UTC)
I've a bunch of test cases for a template that takes lots of complicated parameters, but whose output is a relatively short text. Think {{
cite book}} and you're in the ballpark. I want to see the code up top in a nowiki block like {{
test case nowiki|format=columns}}
or |format=rows
gives me, but I'd like to see the output arranged vertically like {{
test case nowiki|format=inline}}
gives me.
Something like:
Example of desired output
|
---|
|
Any takers? Mr. Stradivarius? -- Xover ( talk) 08:45, 13 January 2023 (UTC)
|_format=
? –
Jonesey95 (
talk) 22:26, 14 January 2023
{{code|foo}}
foo
foo
I'm trying to use the |_before=
parameter, mostly to have something to hange templates that create superscript references, tags, and that sort of thing, so they don't appear to be isolated in space. What I'd like to see in this example, is something like this:
Here's my test case, using |_before=
:
{{ Citation needed}}
Some text to hang a tag on. citation needed
Some text to hang a tag on. citation needed
Am I doing something wrong, here? Why isn't it echoing the "before" text? Mathglot ( talk) 04:29, 26 January 2023 (UTC)
@ Frietjes, re this edit, should we make some change to {{ Test case}} to better handle instances when it's used when there's no sandbox? {{u| Sdkb}} talk 19:42, 19 May 2023 (UTC)
I've changed the <code>...</code>
tags to <syntaxhighlight>...</syntaxhighlight>
tags when |_showcode=
is used.
Sandbox and
Diff.
Gonnym (
talk)
18:04, 23 May 2023 (UTC)
|format=syntaxhighlight
(and/or |format=syntax
maybe) instead? Are there any weird border cases where <code><nowiki>...</nowiki>
</code>
works, but <syntaxhighlight lang="mediawiki" inline>...</syntaxhighlight>
might break?
FeRDNYC (
talk)
04:00, 15 July 2023 (UTC)So, in most of the test case templates, you pass arguments to the test-case code preceded by underscores, and actual arguments to the template being tested are passed as usual, e.g.:
{{Test case|_collapsible=yes|_showcode=yes|_title=Some test case
|_template1=Code
|1=wikitable
}}
OK, great. But then here comes {{
Test case nowiki}}
, where the underscore arguments don't work, and you have to use non-underscored ones:
{{Test case nowiki|_collapsible=yes|_showcode=yes|_title=Some test case
|_template1=Code
|<nowiki>{{__TEMPLATENAME__
|1=wikitable}}</nowiki>
}}
{{Test case nowiki|collapsible=yes|showcode=yes|title=Some test case
|template1=Code
|<nowiki>{{__TEMPLATENAME__
|1=wikitable}}</nowiki>
}}
My question is, why??? If these templates are a "family", and so often used together, doesn't it make sense for {{
Test case nowiki}}
to take the same set of arguments that {{
Test case}}
and all the others take? Even if it's not strictly necessary for them to be preceded by underscores? It would make converting test cases between the non-nowiki and nowiki versions a lot quicker and more convenient. Am I really the only person who finds themselves doing that pretty frequently?
FeRDNYC (
talk)
06:33, 15 July 2023 (UTC)
{{
Test case nowiki}}
can do without them. But in the interests of... I don't know, consistency, harmony, whatever, it seems like bridge.nowiki
could include this logic: local options = {}
for k, v in pairs(args) do
local underscoreOptionKey = type(k) == 'string' and k:match('^_(.*)$')
if underscoreOptionKey then
optionsunderscoreOptionKey = v
else
optionsk = v
end
end
local code = options.code or options1
local invocationObj = NowikiInvocation.new(code, cfg)
options.code = nil
options1 = nil
-- Assume we want to see the code as we already passed it in.
options.showcode = options.showcode or true
local testCaseObj = TestCase.new(invocationObj, options, cfg)
|_collapsible=
and |collapsible=
are equivalent, meaning the user has the option to pass the exact same arguments as all the other templates in the group.
FeRDNYC (
talk)
18:44, 15 July 2023 (UTC)
It is also odd that this module appears in "Pages transcluded onto the current version of this page" when you edit the testcases page- that part makes sense, since {{ Test case}} uses this module, as does {{ Test case nowiki}} and a couple of the other related templates. As for why it took editing this for it to appear in an error report, even I'm not sure on that one. It definitely didn't change the behaviour, so maybe this change just caused it to purge and appear in the report. Could the report have had a recent change on what it picks up? Aidan9382 ( talk) 13:00, 17 July 2023 (UTC)
![]() | This
edit request to
Module:Template test case/config has been answered. Set the |answered= or |ans= parameter to no to reactivate your request. |
Please, remove the n of the word templaten in the line number 29. Nishimoto, Gilberto Kiyoshi ( talk) 16:38, 17 October 2023 (UTC)