diff --git a/tests/parser/funcsParserTests.txt b/tests/parser/funcsParserTests.txt index 6899cf37..efc7c768 100644 --- a/tests/parser/funcsParserTests.txt +++ b/tests/parser/funcsParserTests.txt @@ -1,8 +1,8 @@ +!! Version 2 # Force the test runner to ensure the extension is loaded -# fixme... this doesn't seem to work :D -#!! functionhooks -#time -#!! endfunctionhooks +!! functionhooks +time +!! endfunctionhooks # fixme: #time seems to be accepting input as local time, which strikes me as wrong @@ -35,90 +35,90 @@ File:Redirect_to_nowhere.jpg !! test Input times are UTC, not local time -!! input +!! wikitext {{#time:c|15 January 2001}} -!!result +!! html

2001-01-15T00:00:00+00:00

!! end !! test Time test in traditional range... -!! input +!! wikitext {{#time:Y|15 January 2001}} -!! result +!! html

2001

!! end !! test Time test prior to 1970 Unix creation myth -!! input +!! wikitext {{#time:Y|5 April 1967}} -!! result +!! html

1967

!! end !! test Time test after the 2038 32-bit Apocalype -!! input +!! wikitext {{#time:Y|28 July 2061}} -!! result +!! html

2061

!! end !! test Explicitly specified timezone: UTC -!! input +!! wikitext {{#time:Y-m-d H:i| 2011-11-12 23:00 UTC }} -!! result +!! html

2011-11-12 23:00

!! end !! test Explicitly specified timezone: Europe/Paris (UTC+1) -!! input +!! wikitext {{#time:Y-m-d H:i| 2011-11-12 23:00 Europe/Paris }} -!! result +!! html

2011-11-12 22:00

!! end !! test Explicitly specified timezone: America/New_York (UTC-5) -!! input +!! wikitext {{#time:Y-m-d H:i| 2011-11-12 23:00 America/New_York }} -!! result +!! html

2011-11-13 04:00

!! end !! test Explicitely specified output language (Dutch) -!! input +!! wikitext {{#time:d F Y|1988-02-28|nl}} -!! result +!! html

28 februari 1988

!! end !! test Preserve tags in #switch default value -!! input +!! wikitext {{#switch:a|b|
c
}} -!! result +!! html
c
!! end !! test Bug 19093: Default values don't fall through in switch -!! input +!! wikitext <{{#switch: foo | bar | #default = DEF }}> <{{#switch: foo | #default | bar = DEF }}> -!! result +!! html

<DEF> <DEF>

@@ -126,11 +126,11 @@ Bug 19093: Default values don't fall through in switch !! test {{#ifexist}} -!! input +!! wikitext {{#ifexist:Media:Foobar.jpg|Found|Not found}} {{#ifexist:ParserFunctions page|Found|Not found}} {{#ifexist:Missing|Found|Not found}} -!! result +!! html

Found Found Not found @@ -139,12 +139,12 @@ Not found !! test {{#ifexist:}} media redirect (bug 32031) -!! input +!! wikitext {{#ifexist:Media:Redirect_to_Foobar.jpg|Found|Not found}} {{#ifexist:Media:Redirect_to_nowhere.jpg|Found|Not found}} {{#ifexist:Media:Missing file.jpg|Found|Not found}} {{#ifexist:Media:Dionysos-Brunnen am Kölner Dom.jpg|Found|Not found}} -!!result +!! html

Found Not found Not found @@ -154,7 +154,7 @@ Not found !! test #if -!! input +!! wikitext {{#if: | yes | no}} {{#if: string | yes | no}} {{#if: | yes | no}} @@ -168,7 +168,7 @@ Not found {{#if: foo | | no}}(empty) {{#if: {{{1}}} | yes | no}} {{#if: {{{1|}}} | yes | no}} -!! result +!! html

no yes no @@ -184,13 +184,13 @@ no !! test #ifeq -!!input +!! wikitext {{#ifeq: 01 | 1 | yes | no}} {{#ifeq: 0 | -0 | yes | no}} {{#ifeq: foo | bar | yes | no}} {{#ifeq: foo | Foo | yes | no}} {{#ifeq: "01" | "1" | yes | no}} -!! result +!! html

yes yes no @@ -201,12 +201,12 @@ no !! test #ifeq entities -!!input +!! wikitext {{#ifeq: {{PAGENAME:*foo&bar}} | *foo&bar | yes | no}} {{#ifeq: a'b | a'b | yes | no}} {{#ifeq: a'b | a&#39;b | yes | no}} {{#ifeq: foo | Foo | *yes | *no}} -!! result +!! html

yes yes no @@ -217,14 +217,14 @@ no !! test #iferror -!!input +!! wikitext {{#iferror: {{#expr: 1 + 2 }} | error | correct }} {{#iferror: {{#expr: 1 + X }} | error | correct }} {{#iferror: {{#expr: 1 + 2 }} | error }} {{#iferror: {{#expr: 1 + X }} | error }} {{#iferror: {{#expr: 1 + 2 }} }} {{#iferror: {{#expr: 1 + X }} }}empty -!! result +!! html

correct error 3 @@ -237,14 +237,14 @@ empty !! test #ifexpr -!! input +!! wikitext {{#ifexpr: | yes | no}} {{#ifexpr: 1 > 0 | yes }} {{#ifexpr: 1 < 0 | yes }}empty {{#ifexpr: 1 > 0 | | no}}empty {{#ifexpr: 1 < 0 | | no}} {{#ifexpr: 1 > 0 }}empty -!! result +!! html

no yes empty @@ -256,28 +256,28 @@ empty !! test Bug 22866: #ifexpr should evaluate "-0" as false -!! input +!! wikitext {{#ifexpr: (-1)*0 | true | false }} -!! result +!! html

false

!! end !! test Templates: Parser functions don't strip whitespace from positional parameters -!! input +!! wikitext {{#if: {{foo}} | no-pre-then | no-pre-else }} -!! result +!! html

no-pre-then

!! end !! test #switch -!! input +!! wikitext {{#switch:foo&bar|foo&bar=yes|no}} {{#switch:foo&bar|fred=1|foo&bar|g=yes|no}} {{#switch:foo&bar|fred=1|foo&'bar|g=yes|no}} @@ -285,7 +285,7 @@ Templates: Parser functions don't strip whitespace from positional parameters {{#switch:none|foo=1|bar=2|#default=no match|baz=3}} {{#switch:none|foo=1|bar=2|#default=ignored|baz=3|Second default}} {{#switch:|a&#39;b}} -!! result +!! html

yes yes no @@ -299,10 +299,10 @@ a&#39;b !! test #switch #default should match next and not last named parameter -!! input +!! wikitext <{{#switch: foo | #default | bar = DEF }}> <{{#switch: foo | #default | bar = DEF | baz = GHI }}> -!! result +!! html

<DEF> <DEF>

@@ -310,10 +310,10 @@ a&#39;b !! test #switch should not match #default as a prefix -!! input +!! wikitext <{{#switch: foo | #defaultWTF? = This is crazy }}> <{{#switch: foo | #defaultWTF? | bar = This is crazy }}> -!! result +!! html

<> <>

@@ -321,7 +321,7 @@ a&#39;b !! test #switch Test php truthy -!!input +!! wikitext {{#switch: 01 | 1 = yes | no}} {{#switch: 0 | -0 = yes | no}} {{#switch: foo | bar = yes | no}} @@ -329,7 +329,7 @@ a&#39;b {{#switch: "01" | "1" = yes | no}} {{#switch: 1 | 02 | 01 = yes | no}} {{#switch: 1 | "01" | "1" = yes | no}} -!! result +!! html

yes yes no diff --git a/tests/parser/stringFunctionTests.txt b/tests/parser/stringFunctionTests.txt index b1fb9651..4eb176a2 100644 --- a/tests/parser/stringFunctionTests.txt +++ b/tests/parser/stringFunctionTests.txt @@ -1,15 +1,21 @@ -# @todo expand +!! Version 2 +# Force the test runner to ensure the extension is loaded +# Use '#switch' to do the detection, since we might not have +# string functions enabled (yet) -- they are force-enabled on a per-test +# basis by the ParserTestGlobals hook. !! functionhooks -len +switch !! endfunctionhooks +# @todo expand + !! test #len -!! input +!! wikitext {{#len:}} {{#len:0}} {{#len:test}} -!!result +!! html

0 1 4 @@ -18,12 +24,12 @@ len !! test #urldecode -!! input +!! wikitext {{#urldecode:}} {{#urldecode:foo%20bar}} {{#urldecode:%D0%9C%D0%B5%D0%B4%D0%B8%D0%B0%D0%92%D0%B8%D0%BA%D0%B8}} {{#urldecode: some unescaped string}} -!! result +!! html

foo bar МедиаВики some unescaped string @@ -32,10 +38,10 @@ some unescaped string !! test #pos -!! input +!! wikitext {{#pos:Žmržlina|žlina}} {{#pos:stringstring|str|4}} -!! result +!! html

3 6

@@ -43,8 +49,8 @@ some unescaped string !! test #pos with too large offset (T209600) -!! input +!! wikitext {{#pos:FooBar|Foo|32}} -!! result +!! html !! end