1 # Force the test runner to ensure the extension is loaded
2 # fixme... this doesn't seem to work :D
7 # fixme: #time seems to be accepting input as local time, which strikes me as wrong
12 A sample page so we can test ifexist.
14 This used to be a Main Page, but that caused duplicate article
15 warnings when running the normal tests at the same time.
19 File:Dionysos-Brunnen am Kölner Dom.jpg
25 File:Redirect_to_Foobar.jpg
27 #REDIRECT[[File:Foobar.jpg]]
31 File:Redirect_to_nowhere.jpg
33 #REDIRECT[[File:Missing target file.jpg]]
37 Input times are UTC, not local time
39 {{#time:c|15 January 2001}}
41 <p>2001-01-15T00:00:00+00:00
46 Time test in traditional range...
48 {{#time:Y|15 January 2001}}
55 Time test prior to 1970 Unix creation myth
57 {{#time:Y|5 April 1967}}
64 Time test after the 2038 32-bit Apocalype
66 {{#time:Y|28 July 2061}}
73 Explicitly specified timezone: UTC
75 {{#time:Y-m-d H:i| 2011-11-12 23:00 UTC }}
82 Explicitly specified timezone: Europe/Paris (UTC+1)
84 {{#time:Y-m-d H:i| 2011-11-12 23:00 Europe/Paris }}
91 Explicitly specified timezone: America/New_York (UTC-5)
93 {{#time:Y-m-d H:i| 2011-11-12 23:00 America/New_York }}
100 Explicitely specified output language (Dutch)
102 {{#time:d F Y|1988-02-28|nl}}
109 Preserve tags in #switch default value
111 {{#switch:a|b|<div>c</div>}}
118 Bug 19093: Default values don't fall through in switch
120 <{{#switch: foo | bar | #default = DEF }}>
121 <{{#switch: foo | #default | bar = DEF }}>
131 {{#ifexist:Media:Foobar.jpg|Found|Not found}}
132 {{#ifexist:ParserFunctions page|Found|Not found}}
133 {{#ifexist:Missing|Found|Not found}}
142 {{#ifexist:}} media redirect (bug 32031)
144 {{#ifexist:Media:Redirect_to_Foobar.jpg|Found|Not found}}
145 {{#ifexist:Media:Redirect_to_nowhere.jpg|Found|Not found}}
146 {{#ifexist:Media:Missing file.jpg|Found|Not found}}
147 {{#ifexist:Media:Dionysos-Brunnen am Kölner Dom.jpg|Found|Not found}}
160 {{#if: string | yes | no}}
166 {{#if: 1==2 | yes | no}}
168 {{#if: | yes }}(empty)
169 {{#if: foo | | no}}(empty)
170 {{#if: {{{1}}} | yes | no}}
171 {{#if: {{{1|}}} | yes | no}}
189 {{#ifeq: 01 | 1 | yes | no}}
190 {{#ifeq: 0 | -0 | yes | no}}
191 {{#ifeq: foo | bar | yes | no}}
192 {{#ifeq: foo | Foo | yes | no}}
193 {{#ifeq: "01" | "1" | yes | no}}
206 {{#ifeq: {{PAGENAME:*foo&bar}} | *foo&bar | yes | no}}
207 {{#ifeq: a'b | a'b | yes | no}}
208 {{#ifeq: a'b | a&#39;b | yes | no}}
209 {{#ifeq: foo | Foo | *yes | *no}}
223 {{#iferror: {{#expr: 1 + 2 }} | error | correct }}
224 {{#iferror: {{#expr: 1 + X }} | error | correct }}
225 {{#iferror: {{#expr: 1 + 2 }} | error }}
226 {{#iferror: {{#expr: 1 + X }} | error }}
227 {{#iferror: {{#expr: 1 + 2 }} }}
228 {{#iferror: {{#expr: 1 + X }} }}empty
243 {{#ifexpr: | yes | no}}
244 {{#ifexpr: 1 > 0 | yes }}
245 {{#ifexpr: 1 < 0 | yes }}empty
246 {{#ifexpr: 1 > 0 | | no}}empty
247 {{#ifexpr: 1 < 0 | | no}}
248 {{#ifexpr: 1 > 0 }}empty
260 Bug 22866: #ifexpr should evaluate "-0" as false
262 {{#ifexpr: (-1)*0 | true | false }}
269 Templates: Parser functions don't strip whitespace from positional parameters
283 {{#switch:foo&bar|foo&bar=yes|no}}
284 {{#switch:foo&bar|fred=1|foo&bar|g=yes|no}}
285 {{#switch:foo&bar|fred=1|foo&'bar|g=yes|no}}
286 {{#switch:foo|bar|baz=no|*default}}
287 {{#switch:none|foo=1|bar=2|#default=no match|baz=3}}
288 {{#switch:none|foo=1|bar=2|#default=ignored|baz=3|Second default}}
289 {{#switch:|a&#39;b}}
295 <ul><li>default</li></ul>
303 #switch #default should match next and not last named parameter
305 <{{#switch: foo | #default | bar = DEF }}>
306 <{{#switch: foo | #default | bar = DEF | baz = GHI }}>
314 #switch should not match #default as a prefix
316 <{{#switch: foo | #defaultWTF? = This is crazy }}>
317 <{{#switch: foo | #defaultWTF? | bar = This is crazy }}>
325 #switch Test php truthy
327 {{#switch: 01 | 1 = yes | no}}
328 {{#switch: 0 | -0 = yes | no}}
329 {{#switch: foo | bar = yes | no}}
330 {{#switch: foo | Foo = yes | no}}
331 {{#switch: "01" | "1" = yes | no}}
332 {{#switch: 1 | 02 | 01 = yes | no}}
333 {{#switch: 1 | "01" | "1" = yes | no}}