diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
commit | c9aa36da061816dee256a979c2ff8d2ee41824d9 (patch) | |
tree | 29f7002b80ee984b488bd047dbbd80b36bf892e9 /extensions/ParserFunctions/funcsParserTests.txt | |
parent | b4274e0e33eafb5e9ead9d949ebf031a9fb8363b (diff) | |
parent | d1ba966140d7a60cd5ae4e8667ceb27c1a138592 (diff) |
Merge branch 'archwiki'
# Conflicts:
# skins/ArchLinux.php
# skins/ArchLinux/archlogo.gif
Diffstat (limited to 'extensions/ParserFunctions/funcsParserTests.txt')
-rw-r--r-- | extensions/ParserFunctions/funcsParserTests.txt | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/extensions/ParserFunctions/funcsParserTests.txt b/extensions/ParserFunctions/funcsParserTests.txt index 2ff7ba3d..06224bad 100644 --- a/extensions/ParserFunctions/funcsParserTests.txt +++ b/extensions/ParserFunctions/funcsParserTests.txt @@ -21,6 +21,18 @@ File:Dionysos-Brunnen am Kölner Dom.jpg blah blah !! endarticle +!! article +File:Redirect_to_Foobar.jpg +!! text +#REDIRECT[[File:Foobar.jpg]] +!! endarticle + +!! article +File:Redirect_to_nowhere.jpg +!! text +#REDIRECT[[File:Missing target file.jpg]] +!! endarticle + !! test Input times are UTC, not local time !! input @@ -127,6 +139,21 @@ Not found !! end !! test +{{#ifexist:}} media redirect (bug 32031) +!! input +{{#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 +<p>Found +Not found +Not found +Not found +</p> +!!end + +!! test #if !! input {{#if: | yes | no}} @@ -174,6 +201,23 @@ no !! end !! test +#ifeq entities +!!input +{{#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 +<p>yes +yes +no +</p> +<ul><li>no</li></ul> + +!! end + + +!! test #iferror !!input {{#iferror: {{#expr: 1 + 2 }} | error | correct }} @@ -232,3 +276,47 @@ Templates: Parser functions don't strip whitespace from positional parameters <p>no-pre-then </p> !! end + +!! test +#switch +!! input +{{#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}} +{{#switch:foo|bar|baz=no|*default}} +{{#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 +<p>yes +yes +no +</p> +<ul><li>default</li></ul> +<p>no match +Second default +a&#39;b +</p> +!!end + +!! test +#switch #default should match next and not last named parameter +!! input +<{{#switch: foo | #default | bar = DEF }}> +<{{#switch: foo | #default | bar = DEF | baz = GHI }}> +!! result +<p><DEF> +<DEF> +</p> +!! end + +!! test +#switch should not match #default as a prefix +!! input +<{{#switch: foo | #defaultWTF? = This is crazy }}> +<{{#switch: foo | #defaultWTF? | bar = This is crazy }}> +!! result +<p><> +<> +</p> +!! end |