X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FparserTests.txt;h=43463c0e31b3932a757cb1b2a6727faad9c9e98c;hb=06e2f914846efb62ee2165e5b6a6a36485e3177a;hp=bce9866d85fe602c7ec84e602e00a33f47c1fefa;hpb=3c0f03cd8597e4530a7219287687e2cf9102e6a2;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index bce9866d85..43463c0e31 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -18,7 +18,8 @@ # subpage enable subpages (disabled by default) # noxml don't check for XML well formdness # title=[[XXX]] run test using article title XXX -# language=XXX set content language to XXX for this test +# language=XXX set content language to XXX for this test +# variant=XXX set the variant of language for this test (eg zh-tw) # disabled do not run test # # For testing purposes, temporary articles can created: @@ -32,6 +33,23 @@ Main Page blah blah !! endarticle +!!article +Template:Foo +!!text +FOO +!!endarticle + +!! article +Template:Blank +!! text +!! endarticle + +!! article +Template:! +!! text +| +!! endarticle + ### ### Basic tests ### @@ -80,6 +98,7 @@ Italics and bold * plain''italic'''bold-italic'''''plain * plain'''bold''bold-italic'''''plain * plain l'''italic''plain +* plain l''''bold''' plain !! result
--> +
-->
!! end @@ -263,7 +283,7 @@ Comment semantics: nesting !! input --> !! result ---> +
-->
!! end @@ -275,6 +295,26 @@ Comment semantics: unclosed comment at end !! end +!! test +Comment in template title +!! input +{{foo}} +!! result +FOO +
+!! end + +!! test +Comment on its own line post-expand +!! input +a +{{blank}} +b +!! result +a +
b +
+!! end ### ### Preformatted text @@ -377,7 +417,7 @@ Simple definition !! end !! test -Simple definition +Definition list for indentation only !! input : Indented text !! result @@ -421,14 +461,14 @@ Definition list with wikilink containing colon !! input ; [[Help:FAQ]]: The least-read page on Wikipedia !! result -Numbered: [1] Numbered: [2] -Numbered: [3] +Numbered: [3]
!!end @@ -714,11 +754,20 @@ External links: [encoded equals] (bug 6102) !! end !! test -External links: [illegal character reference in hostname] +External links: [IDN ignored character reference in hostname; strip it right off] !! input [http://example.com/] !! result -[http://example.com/] +
[1] +
+!! end + +!! test +External links: IDN ignored character reference in hostname; strip it right off +!! input +http://example.com/ +!! result + !! end @@ -838,7 +887,7 @@ External links: wiki links within external link (Bug 3695) !! input [http://example.com [[wikilink]] embedded in ext link] !! result -wikilink embedded in ext link +
!! end @@ -973,7 +1022,23 @@ External link containing double-single-quotes in text embedded in italics (bug 4 !! end +!! test +URL-encoding in URL functions (single parameter) +!! input +{{localurl:Some page|amp=&}} +!! result +/index.php?title=Some_page&=& +
+!! end +!! test +URL-encoding in URL functions (multiple parameters) +!! input +{{localurl:Some page|q=?&=&}} +!! result +/index.php?title=Some_page&q=?&=& +
+!! end ### ### Quotes @@ -1199,16 +1264,18 @@ Invalid attributes in table cell (bug 1830) !! end -# FIXME: this one has incorrect tag nesting still. +# FIXME: It's not clear at all that this is the result we want, but the actual +# output right now is invalid XML, so clearly something is wrong. The result +# specified here is now valid XML, which is an improvement . . . !! test -Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html) +Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html) !! input {| | |[ftp://|x||]" onmouseover="alert(document.cookie)">test !! result[1] | " onmouseover="alert(document.cookie)">test + | [1] | " onmouseover="alert(document.cookie)">test |
Special:ThisNameWillHopefullyNeverBeUsed#anchor
!! end @@ -1267,9 +1361,9 @@ xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main !! test Link with suffix !! input -[[Main Page]]xxx, [[Main Page]]XXX +[[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!! !! result -Main Pagexxx, Main PageXXX +
Main Pagexxx, Main PageXXX, Main Page!!!
!! end @@ -1305,7 +1399,7 @@ Link to namespaces !! input [[Talk:Parser testing]], [[Meta:Disclaimers]] !! result -Talk:Parser testing, Meta:Disclaimers +
Talk:Parser testing, Meta:Disclaimers
!! end @@ -1314,7 +1408,7 @@ Piped link to namespace !! input [[Meta:Disclaimers|The disclaimers]] !! result - !! end @@ -1332,7 +1426,7 @@ Link containing % (not as a hex sequence) !! input [[7% Solution]] !! result - !! end @@ -1341,7 +1435,7 @@ Link containing % as a single hex sequence interpreted to char !! input [[7%25 Solution]] !! result - !!end @@ -1387,7 +1481,7 @@ Link containing double-single-quotes '' in text (bug 4598 sanity check) !! input Some [[Link|pretty ''italics'' and stuff]]! !! result -Some pretty italics and stuff! +
Some pretty italics and stuff!
!! end @@ -1396,16 +1490,16 @@ Link containing double-single-quotes '' in text embedded in italics (bug 4598 sa !! input ''Some [[Link|pretty ''italics'' and stuff]]! !! result -Some pretty italics and stuff! +
Some pretty italics and stuff!
!! end !! test Plain link to URL !! input -[[http://www.example.org]] +[[http://www.example.com]] !! result -[[1]] +
[[1]]
!! end @@ -1416,16 +1510,16 @@ Plain link to URL # ---- # I'm changing it to match the current output--it arguably makes more # sense in the light of the test above. Old expected result was: -#Piped link to URL: an example URL +#
Piped link to URL: an example URL #
# But I think this test is bordering on "garbage in, garbage out" anyway. # -- wtm !! test Piped link to URL !! input -Piped link to URL: [[http://www.example.org|an example URL]] +Piped link to URL: [[http://www.example.com|an example URL]] !! result -Piped link to URL: [example URL] +
Piped link to URL: [example URL]
!! end @@ -1460,6 +1554,34 @@ title=[[Main Page]] !! end +!! article +00 +!! text +This is 00. +!! endarticle + +!!test +Self-link to numeric title +!!options +title=[[0]] +!!input +[[0]] +!!result +0 +
+!!end + +!!test +Link to numeric-equivalent title +!!options +title=[[0]] +!!input +[[00]] +!!result +00 +
+!!end + !! testBlah blah blah +
+!! end + +!! test +Double interlanguage link +!! input +Blah blah blah +[[es:Spanish]] +[[zh:Chinese]] +!!result +Blah blah blah +
+!! end + +!! test +Interlanguage link, with prefix links +!! options +language=ln +!! input +Blah blah blah +[[zh:Chinese]] +!!result +Blah blah blah +
+!! end + +!! test +Double interlanguage link, with prefix links (bug 8897) +!! options +language=ln +!! input +Blah blah blah +[[es:Spanish]] +[[zh:Chinese]] +!!result +Blah blah blah +
+!! end + + ## ## XHTML tidiness ### @@ -1802,7 +1971,7 @@ Magic Word: {{NUMBEROFARTICLES}} !! input {{NUMBEROFARTICLES}} !! result -1 +
2
!! end @@ -1944,7 +2113,7 @@ Magic links: internal link to RFC (bug 479) !! input [[RFC 123]] !! result -RFC 123 +
!! end @@ -1953,7 +2122,7 @@ Magic links: RFC (bug 479) !! input RFC 822 !! result -RFC 822 +
!! end @@ -1962,7 +2131,7 @@ Magic links: ISBN (bug 1937) !! input ISBN 0-306-40615-2 !! result - !! end @@ -1984,7 +2153,7 @@ Nonexistant template !! input {{thistemplatedoesnotexist}} !! result -Template:Thistemplatedoesnotexist +
Template:Thistemplatedoesnotexist
!! end @@ -2161,12 +2330,12 @@ Template with complex template as argument !! end !! test -Template with thumb image (wiht link in description) +Template with thumb image (with link in description) !! input {{paramtest| param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}} !! result -This is a test template with parameter +This is a test template with parameter !! end @@ -2275,7 +2444,7 @@ Template infinite loop !! input {{loop1}} !! result -{{loop1}} +
Template loop detected: Template:Loop1
!! end @@ -2440,6 +2609,64 @@ FooImage:test !! input [[:Image:test]] !! result -
!! end @@ -2733,7 +3119,7 @@ Frameless image caption with a free URL !! input [[Image:foobar.jpg|http://example.com]] !! result - !! end @@ -2742,16 +3128,16 @@ Thumbnail image caption with a free URL !! input [[Image:foobar.jpg|thumb|http://example.com]] !! result - + !! end !! test BUG 1887: A ISBN with a thumbnail !! input -[[Image:foobar.jpg|thumb|ISBN 12354]] +[[Image:foobar.jpg|thumb|ISBN 1235467890]] !! result - + !! end @@ -2760,7 +3146,7 @@ BUG 1887: A RFC with a thumbnail !! input [[Image:foobar.jpg|thumb|This is RFC 12354]] !! result -/subpage +
!! end @@ -2935,7 +3321,7 @@ subpage title=[[Page]] !! input {{/Subpage}} !! result - !! end @@ -2953,7 +3339,7 @@ Link to category !! input [[:Category:MediaWiki User's Guide]] !! result -Category:MediaWiki User's Guide +
Category:MediaWiki User's Guide
!! end @@ -2964,7 +3350,16 @@ cat !! input [[Category:MediaWiki User's Guide]] !! result -MediaWiki User's Guide +MediaWiki User's Guide +!! end + +!! test +PAGESINCATEGORY invalid title fatal (r33546 fix) +!! input +{{PAGESINCATEGORY:0 +
!! end ### @@ -2987,8 +3382,6 @@ es:Alimento fr:Nourriture zh:é£å ### !! test Basic section headings -!! options -title=[[Parser test script]] !! input == Headline 1 == Some text @@ -2998,21 +3391,19 @@ More ===Smaller headline=== Blah blah !! result -Some text
-More
-Blah blah
!! end !! test Section headings with TOC -!! options -title=[[Parser test script]] !! input == Headline 1 == === Subheadline 1 === @@ -3045,14 +3436,14 @@ Some text -Some text
-Contents
|
Contents |
Contents |
C'est grave ! +
+!! end + +!! test +Punctuation: CSS !important (bug 11874) +!! input +Contents
[edit] a+[edit] a
JavaScript + JavaScript !! end @@ -5595,9 +6133,9 @@ __FORCETOC__ !! test ISBN code coverage !! input -ISBN 983 987 +ISBN 978-0-1234-56 789 !! result -ISBN 983 987 + !! end @@ -5612,12 +6150,10 @@ ISBN !! test Double ISBN -!! options -disabled # Disabled until Bug 6560 resolved !! input -ISBN ISBN 1234 +ISBN ISBN 1234567890 !! result -ISBN ISBN 1234 + ISBN ISBN 1234567890 !! end @@ -5626,16 +6162,16 @@ Double RFC !! input RFC RFC 1234 !! result -RFC RFC 1234 + RFC RFC 1234 !! end !! test Double RFC with a wiki link !! input -RFC [[RFC 1234 +RFC [[RFC 1234]] !! result -RFC [[RFC 1234 + RFC RFC 1234 !! end @@ -5644,7 +6180,7 @@ RFC code coverage !! input RFC 983 987 !! result -RFC 983 987 + RFC 983 987 !! end @@ -5653,7 +6189,7 @@ Centre-aligned image !! input [[Image:foobar.jpg|centre]] !! result - + !!end @@ -5662,7 +6198,7 @@ None-aligned image !! input [[Image:foobar.jpg|none]] !! result - + !!end @@ -5671,7 +6207,34 @@ Width + Height sized image (using px) (height is ignored) !! input [[Image:foobar.jpg|640x480px]] !! result - +!!end + +!! test +Width-sized image (using px, no following whitespace) +!! input +[[Image:foobar.jpg|640px]] +!! result + +!!end + +!! test +Width-sized image (using px, with following whitespace - test regression from r39467) +!! input +[[Image:foobar.jpg|640px ]] +!! result + +!!end + +!! test +Width-sized image (using px, with preceding whitespace - test regression from r39467) +!! input +[[Image:foobar.jpg| 640px]] +!! result + !!end @@ -5693,15 +6256,840 @@ dt/dd/dl test :;;;:: !! result![]() An external URL <html><script>alert(1);</script></html> + +!! end + +!! test +HTML with raw HTML ($wgRawHtml==true) +!! options +rawhtml +!! input + +!! result ++ +!! end + +!! test +Parents of subpages, one level up +!! options +subpage title=[[Subpage test/L1/L2/L3]] +!! input +[[../|L2]] +!! result +L2 + +!! end + + +!! test +Parents of subpages, one level up, not named +!! options +subpage title=[[Subpage test/L1/L2/L3]] +!! input +[[../]] +!! result + +!! end + + + +!! test +Parents of subpages, two levels up +!! options +disabled +subpage title=[[Subpage test/L1/L2/L3]] +!! input +[[../../|L1]]2 +!! result +L1 + +!! end + +!! test +Parents of subpages, two levels up, without trailing slash or name. +!! options +subpage title=[[Subpage test/L1/L2/L3]] +!! input +[[../..]] +!! result +[[../..]] + +!! end + +!! test +Parents of subpages, two levels up, with lots of extra trailing slashes. +!! options +subpage title=[[Subpage test/L1/L2/L3]] +!! input +[[../../////]] +!! result +/// + +!! end + +!! test +Definition list code coverage +!! input +; title : def +; title : def +;title: def +!! result +hello world
+!! result
+hello world
+
+!! end
+
+!! test
+MSGNW magic word
+!! input
+{{MSGNW:msg}}
+!! result
+[[:Template:Msg]] + +!! end + +!! test +RAW magic word +!! input +{{RAW:QUERTY}} +!! result + +!! end + +# This isn't needed for XHTML conformance, but would be handy as a fallback security measure +!! test +Always escape literal '>' in output, not just after '<' +!! input +><> +!! result +><> + +!! end + +!! test +Template caching +!! input +{{Test}} +{{Test}} +!! result +This is a test template +This is a test template + +!! end + + +!! article +MediaWiki:Fake +!! text +==header== +!! endarticle + +!! test +Inclusion of !userCanEdit() content +!! input +{{MediaWiki:Fake}} +!! result +[edit] header+ +!! end + + +!! test +Out-of-order TOC heading levels +!! input +==2== +======6====== +===3=== +=1= +=====5===== +==2== +!! result +
[edit] 2+[edit] 6+[edit] 3+[edit] 1+[edit] 5+[edit] 2+ +!! end + + +!! test +ISBN with a dummy number +!! input +ISBN --- +!! result +ISBN --- + +!! end + + +!! test +ISBN with space-delimited number +!! input +ISBN 92 9017 032 8 +!! result + +!! end + + +!! test +ISBN with multiple spaces, no number +!! input +ISBN foo +!! result +ISBN foo + +!! end + + +!! test +ISBN length +!! input +ISBN 123456789 + +ISBN 1234567890 + +ISBN 12345678901 +!! result +ISBN 123456789 + ISBN 12345678901 + +!! end + + +!! test +ISBN with trailing year (bug 8110) +!! input +ISBN 1-234-56789-0 - 2006 + +ISBN 1 234 56789 0 - 2006 +!! result +ISBN 1-234-56789-0 - 2006 + ISBN 1 234 56789 0 - 2006 + +!! end + + +!! test +Pages in namespace (Magic word disabled currently) +!! input +{{PAGESINNAMESPACE:}} +!! result + +!! end + + +!! test +anchorencode +!! input +{{anchorencode:foo bar©#%n}} +!! result +foo_bar.C2.A9.23.25n + +!! end + + +!! test +Bug 8293: Use of center tag ruins paragraph formatting +!! input +foo + +bar + +baz ++!! end + + +### +### Language variants related tests +### +!! test +Self-link in language variants +!! options +title=[[Dunav]] language=sr +!! input +Both [[Dunav]] and [[ÐÑнав]] are names for this river. +!! result + Both Dunav and ÐÑнав are names for this river. + +!!end + + +!! test +Link to pages in language variants +!! options +language=sr +!! input +Main Page can be written as [[Ðаин Ðаге]] +!! result +Main Page can be written as Ðаин Ðаге + +!!end + + +!! test +Multiple links to pages in language variants +!! options +language=sr +!! input +[[Main Page]] can be written as [[Ðаин Ðаге]] same as [[Ðаин Ðаге]]. +!! result +Main Page can be written as Ðаин Ðаге same as Ðаин Ðаге. + +!!end + + +!! test +Simple template in language variants +!! options +language=sr +!! input +{{ÑеÑÑ}} +!! result +This is a test template + +!! end + + +!! test +Template with explicit namespace in language variants +!! options +language=sr +!! input +{{Template:ÑеÑÑ}} +!! result +This is a test template + +!! end + + +!! test +Basic test for template parameter in language variants +!! options +language=sr +!! input +{{паÑамÑеÑÑ|param=foo}} +!! result +This is a test template with parameter foo + +!! end + + +!! test +Simple category in language variants +!! options +language=sr cat +!! input +[[:Category:ÐедиаWики УÑеÑ'Ñ ÐÑиде]] +!! result +MediaWiki User's Guide +!! end + + +!! test +Stripping -{}- tags (language variants) +!! options +language=sr +!! input +Latin proverb: -{Ne nuntium necare}- +!! result +Latin proverb: Ne nuntium necare + +!! end + + +!! test +Prevent conversion with -{}- tags (language variants) +!! options +language=sr variant=sr-ec +!! input +Latinski: -{Ne nuntium necare}- +!! result +ÐаÑинÑки: Ne nuntium necare + +!! end + + +!! test +Prevent conversion of text with -{}- tags (language variants) +!! options +language=sr variant=sr-ec +!! input +Latinski: -{Ne nuntium necare}- +!! result +ÐаÑинÑки: Ne nuntium necare + +!! end + + +!! test +Prevent conversion of links with -{}- tags (language variants) +!! options +language=sr variant=sr-ec +!! input +-{[[Main Page]]}- +!! result + +!! end + + +!! test +-{}- tags within headlines (within html for parserConvert()) +!! options +language=sr variant=sr-ec +!! input +== -{Naslov}- == +!! result +[ÑÑеди] Naslov+ +!! end + + +!! test +Explicit definition of language variant alternatives +!! options +language=zh variant=zh-tw +!! input +-{zh:China;zh-tw:Taiwan}-, not China +!! result +Taiwan, not China + +!! end + + +!! test +Adding explicit session-wise language variant mapping (A flag) +!! options +language=zh variant=zh-tw +!! input +-{A|zh:China;zh-tw:Taiwan}- is China +!! result +Taiwan is Taiwan + +!! end + + +!! test +Adding explicit conversion rule for title (T flag) +!! options +language=zh variant=zh-tw +!! input +Should be stripped-{T|zh:China;zh-tw:Taiwan}-! +!! result +Should be stripped! + +!! end + + +!! test +Raw output of variant escape tags (R flag) +!! options +language=zh variant=zh-tw +!! input +Raw: -{R|zh:China;zh-tw:Taiwan}- +!! result +Raw: zh:China;zh-tw:Taiwan + +!! end + + +!! test +Do not convert roman numbers to language variants +!! options +language=sr variant=sr-ec +!! input +Fridrih IV je car. +!! result +ФÑидÑÐ¸Ñ IV Ñе ÑаÑ. + +!! end + +!!article +Template:Bullet +!!text +* Bar +!!endarticle + +!! test +Bug 529: Uncovered bullet +!! input +* Foo {{bullet}} +!! result +x + +
y + +!! end + +!! test +Bug 529: Uncovered bullet in parser function result +!! input +* Foo {{lc:{{bullet}} }} +!! result +{{{1}}} + +!! end + +!! test +Bug 5678: Double-parsed template invocation +!! input +{{lc:{{paramtest {{!}} param = hello }} }} +!! result +{{paramtest | param = hello }} + +!! end + +!! test +Morwen/13: Unclosed link followed by heading +!! input +[[link +==heading== +!! result +[[link + +[edit] heading+ +!! end + +!! test +HHP2.1: Heuristics for headings in preprocessor parenthetical structures +!! input +{{foo| +=heading= +!! result +{{foo| + +heading+ +!! end + +!! test +HHP2.2: Heuristics for headings in preprocessor parenthetical structures +!! input +{{foo| +==heading== +!! result +{{foo| + +[edit] heading+ +!! end + +!! test +Tildes in comments +!! options +pst +!! input + +!! result + +!! end + +!! test +Paragraphs inside divs (no extra line breaks) +!! input +Line one
+
+Line two
+!! result
+Line one
+Line two
+
+!! end
+
+!! test
+Paragraphs inside divs (extra line break on open)
+!! input
+
+Line one
+
+Line two
+!! result
+
+
+
+!! end
+
+!! test
+Paragraphs inside divs (extra line break on close)
+!! input
+Line one + +Line twoLine one
+
+Line two
+
+!! result
+Line one
+
+
+!! end
+
+!! test
+Paragraphs inside divs (extra line break on open and close)
+!! input
+Line two + +
+Line one
+
+Line two
+
+!! result
+
+
+
+!! end
+
+# Bug 6200: Line one + Line two + +should behave like |