mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ParserFunctions
synced 2024-12-24 05:44:03 +00:00
6905775132
Bug 19093. Previously {{#switch:foo|bar|#default=baz}} would behave differently from {{#switch:foo|#default|bar=baz}}, even though they'd behave identically if "#default" was replaced by "foo". I changed switchObj but not switchHook. In testing, switchObj was the only method that seemed to be used, and I didn't want to make untested changes to switchHook, so if that's used, the behavior may remain in some cases. It seems like code is duplicated between them -- whatever the difference is, that should probably be factored out. This passes all existing parser tests for #switch, of which there are none, so don't blame me if it breaks something. ;)
55 lines
924 B
Plaintext
55 lines
924 B
Plaintext
# Force the test runner to ensure the extension is loaded
|
|
# fixme... this doesn't seem to work :D
|
|
#!! functionhooks
|
|
#time
|
|
#!! endfunctionhooks
|
|
|
|
# fixme: #time seems to be accepting input as local time, which strikes me as wrong
|
|
|
|
!! test
|
|
Input times should probably be UTC, not local time
|
|
!! input
|
|
{{#time:c|15 January 2001}}
|
|
!!result
|
|
<p>2001-01-15T00:00:00+00:00
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Time test in traditional range...
|
|
!! input
|
|
{{#time:Y|15 January 2001}}
|
|
!! result
|
|
<p>2001
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Time test prior to 1970 Unix creation myth
|
|
!! input
|
|
{{#time:Y|5 April 1967}}
|
|
!! result
|
|
<p>1967
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Time test after the 2038 32-bit Apocalype
|
|
!! input
|
|
{{#time:Y|28 July 2061}}
|
|
!! result
|
|
<p>2061
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Bug 19093: Default values don't fall through in switch
|
|
!! input
|
|
<{{#switch: foo | bar | #default = DEF }}>
|
|
<{{#switch: foo | #default | bar = DEF }}>
|
|
!! result
|
|
<p><DEF>
|
|
<DEF>
|
|
</p>
|
|
!! end
|