Jump to content

Module talk:Yesno: Difference between revisions

From Fifth Empire Wiki
Added test cases of wikitext version
Undid revision 541929442 by Ori.livneh (talk) Ooops
Line 1: Line 1:
{{yesno|yes}}
{| class="wikitable"
{{yesno|YeS}}
|+ Test Cases (via [[Template:Yesno/doc]])
{{yesno|Y}}
|-
{{yesno|y}}
! Module output
{{yesno|no}}
! Template output
{{yesno|}}
! Expected
{{yesno}}
|-
{{yesno|¬}}
| {{#invoke:Yesno|yesno|yes}}
{{yesno|purplemonkeydishwasher}}
| {{yesno|yes}}
{{yesno|yes|yes=bacon}}
| yes
{{yesno|no|no=ham}}
|-
{{yesno|blank= eggs}}
| {{#invoke:Yesno|yesno|YeS}}
{{yesno|no=ham}}
| {{yesno|YeS}}
{{yesno|blank= eggs|no=ham}}
| yes
{{yesno|¬|¬=sausage}}
|-
{{yesno|purplemonkeydishwasher|def=cup-of-tea}}
| {{#invoke:Yesno|yesno|Y}}
{{yesno|purplemonkeydishwasher|yes=bacon}}
| {{yesno|Y}}
{{yesno|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}}
| yes
{{yesno|yes|yes=no|no=yes}}
|-
{{yesno|no|yes=no|no=yes}}
| {{#invoke:Yesno|yesno|y}}
{{yesno| no |no=no}}
| {{yesno|y}}
| yes
|-
| {{#invoke:Yesno|yesno|no}}
| {{yesno|no}}
| ''(blank)''
|-
| {{#invoke:Yesno|yesno|}}
| {{yesno|}}
| ''(blank)''
|-
| {{#invoke:Yesno|yesno}}
| {{yesno}}
| ''(blank)''
|-
| {{#invoke:Yesno|yesno|¬}}
| {{yesno|¬}}
| ''(blank)''
|-
| {{#invoke:Yesno|yesno|purplemonkeydishwasher}}
| {{yesno|purplemonkeydishwasher}}
| yes
|-
| {{#invoke:Yesno|yesno|yes|yes=bacon}}
| {{yesno|yes|yes=bacon}}
| bacon
|-
| {{#invoke:Yesno|yesno|no|no=ham}}
| {{yesno|no|no=ham}}
| ham
|-
| {{#invoke:Yesno|yesno|blank= eggs}}
| {{yesno|blank= eggs}}
| eggs
|-
| {{#invoke:Yesno|yesno|no=ham}}
| {{yesno|no=ham}}
| ham
|-
| {{#invoke:Yesno|yesno|blank= eggs|no=ham}}
| {{yesno|blank= eggs|no=ham}}
| eggs
|-
| {{#invoke:Yesno|yesno|¬|¬=sausage}}
| {{yesno|¬|¬=sausage}}
| sausage
|-
| {{#invoke:Yesno|yesno|purplemonkeydishwasher|def=cup-of-tea}}
| {{yesno|purplemonkeydishwasher|def=cup-of-tea}}
| cup-of-tea
|-
| {{#invoke:Yesno|yesno|purplemonkeydishwasher|yes=bacon}}
| {{yesno|purplemonkeydishwasher|yes=bacon}}
| bacon
|-
| {{#invoke:Yesno|yesno|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}}
| {{yesno|purplemonkeydishwasher|def=cup-of-tea|yes=bacon}}
| cup-of-tea
|-
| {{#invoke:Yesno|yesno|yes|yes=no|no=yes}}
| {{yesno|yes|yes=no|no=yes}}
| no
|-
| {{#invoke:Yesno|yesno|no|yes=no|no=yes}}
| {{yesno|no|yes=no|no=yes}}
| yes
|-
| {{#invoke:Yesno|yesno| no |no=no}}
| {{yesno| no |no=no}}
| no
|}
 
As you can see, the template does not behave exactly as its documentation claims it does. I was not sure which to regard as authoritative: the ideal or actual implementation. I ultimately went with the former. Removing <code>and not any</code> from the Lua code will make the module behave like exactly like the template.
 
--[[User:Ori.livneh|Ori.livneh]] ([[User talk:Ori.livneh|talk]]) 10:46, 28 February 2013 (UTC)
 
:Just needs to handle spaces in the params better. -- [[User:WOSlinker|WOSlinker]] ([[User talk:WOSlinker|talk]]) 11:41, 2 March 2013 (UTC)
::Thanks. Fixed. I moved your test case to the table above. --[[User:Ori.livneh|Ori.livneh]] ([[User talk:Ori.livneh|talk]]) 05:58, 3 March 2013 (UTC)

Revision as of 19:19, 3 March 2013

Test Cases (via Template:Yesno/doc)
Module output Template output Expected
Script error: The module returned a function value. It is supposed to return an export table. yes yes
Script error: The module returned a function value. It is supposed to return an export table. yes yes
Script error: The module returned a function value. It is supposed to return an export table. yes yes
Script error: The module returned a function value. It is supposed to return an export table. yes yes
Script error: The module returned a function value. It is supposed to return an export table. (blank)
Script error: The module returned a function value. It is supposed to return an export table. (blank)
Script error: The module returned a function value. It is supposed to return an export table. (blank)
Script error: The module returned a function value. It is supposed to return an export table. (blank)
Script error: The module returned a function value. It is supposed to return an export table. yes yes
Script error: The module returned a function value. It is supposed to return an export table. bacon bacon
Script error: The module returned a function value. It is supposed to return an export table. ham ham
Script error: The module returned a function value. It is supposed to return an export table. eggs
Script error: The module returned a function value. It is supposed to return an export table. ham
Script error: The module returned a function value. It is supposed to return an export table. eggs
Script error: The module returned a function value. It is supposed to return an export table. sausage sausage
Script error: The module returned a function value. It is supposed to return an export table. cup-of-tea cup-of-tea
Script error: The module returned a function value. It is supposed to return an export table. bacon bacon
Script error: The module returned a function value. It is supposed to return an export table. cup-of-tea cup-of-tea
Script error: The module returned a function value. It is supposed to return an export table. no no
Script error: The module returned a function value. It is supposed to return an export table. yes yes
Script error: The module returned a function value. It is supposed to return an export table. no no

As you can see, the template does not behave exactly as its documentation claims it does. I was not sure which to regard as authoritative: the ideal or actual implementation. I ultimately went with the former. Removing and not any from the Lua code will make the module behave like exactly like the template.

--Ori.livneh (talk) 10:46, 28 February 2013 (UTC)

Just needs to handle spaces in the params better. -- WOSlinker (talk) 11:41, 2 March 2013 (UTC)
Thanks. Fixed. I moved your test case to the table above. --Ori.livneh (talk) 05:58, 3 March 2013 (UTC)