X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FparserTests.txt;h=03763613a80f9574631d22ae7363b13c3ed81a61;hb=1bb1a2c843a6defa2961ea5acb66397e0ecd0f86;hp=626ca4ba9538ed76c335392578df711ecdc61c93;hpb=d1aaba0a64104927d1225e9906274b4fab67e221;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 626ca4ba95..03763613a8 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -156,7 +156,7 @@ nowiki 3 !! end ### -### comment test cases +### Comments ### !! test Comment test 1 @@ -239,7 +239,7 @@ And a link !! end ### -### Definition list +### Definition lists ### !! test Simple definition @@ -276,7 +276,7 @@ Definition list with URL link !! input ; http://example.com/ : definition !! result -
http://example.com/ 
definition +
http://example.com/ 
definition
!! end @@ -286,7 +286,7 @@ Definition list with bracketed URL link !! input ;[http://www.google.com/ Google]:Number one search engine !! result -
Google (http://www.google.com/)
Number one search engine +
Google
Number one search engine
!! end @@ -294,9 +294,9 @@ Definition list with bracketed URL link !! test Definition list with wikilink containing colon !! input -; [[Wikipedia:FAQ]]: The least-read page on Wikipedia +; [[Help:FAQ]]: The least-read page on Wikipedia !! result -
Wikipedia:FAQ
The least-read page on Wikipedia +
Help:FAQ
The least-read page on Wikipedia
!! end @@ -307,7 +307,7 @@ Definition list with wikilink containing colon !! input ; news:alt.wikipedia.rox: This isn't even a real newsgroup! !! result -
news:alt.wikipedia.rox
This isn't even a real newsgroup! +
news:alt.wikipedia.rox
This isn't even a real newsgroup!
!! end @@ -317,7 +317,7 @@ Malformed definition list with colon !! input ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop !! result -
news:alt.wikipedia.rox -- don't crash or enter an infinite loop +
news:alt.wikipedia.rox — don't crash or enter an infinite loop
!! end @@ -327,7 +327,7 @@ Definition lists: colon in external link text !! input ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up !! result -
Wikipedia : The Next Generation (http://www.wikipedia2.org/)
OK, I made that up +
Wikipedia : The Next Generation
OK, I made that up
!! end @@ -341,7 +341,7 @@ External links: non-bracketed !! input Non-bracketed: http://example.com !! result -

Non-bracketed: http://example.com +

Non-bracketed: http://example.com

!! end @@ -349,8 +349,12 @@ Non-bracketed: http://example.com External links: numbered !! input Numbered: [http://example.com] +Numbered: [http://example.net] +Numbered: [http://example.org] !! result -

Numbered: [1] (http://example.com) +

Numbered: [1] +Numbered: [2] +Numbered: [3]

!!end @@ -359,16 +363,16 @@ External links: specified text !! input Specified text: [http://example.com link] !! result -

Specified text: link (http://example.com) +

Specified text: link

!!end !! test External links: trail !! input -Trail (not sure if this is meant to work): [http://example.com link]s +Linktrails should not work for external links: [http://example.com link]s !! result -

Trail (not sure if this is meant to work): links (http://example.com) +

Linktrails should not work for external links: links

!! end @@ -377,7 +381,7 @@ External links: dollar sign in URL !! input http://example.com/1$2345 !! result -

http://example.com/1$2345 +

http://example.com/1$2345

!! end @@ -386,7 +390,7 @@ External links: dollar sign in URL (named) !! input [http://example.com/1$2345] !! result -

[1] (http://example.com/1$2345) +

[1]

!!end @@ -413,7 +417,7 @@ Link to non-http image, no img tag !! input Link to non-http image, no img tag: ftp://example.com/test.jpg !! result -

Link to non-http image, no img tag: ftp://example.com/test.jpg +

Link to non-http image, no img tag: ftp://example.com/test.jpg

!! end @@ -422,7 +426,7 @@ External links: terminating separator !! input Terminating separator: http://example.com/thing, !! result -

Terminating separator: http://example.com/thing, +

Terminating separator: http://example.com/thing,

!! end @@ -431,7 +435,7 @@ External links: intervening separator !! input Intervening separator: http://example.com/1,2,3 !! result -

Intervening separator: http://example.com/1,2,3 +

Intervening separator: http://example.com/1,2,3

!! end @@ -440,7 +444,7 @@ External links: old bug with URL in query !! input Old bug with URL in query: [http://example.com/thing?url=http://example.com link] !! result -

Old bug with URL in query: link (http://example.com/thing?url=http://example.com) +

Old bug with URL in query: link

!! end @@ -449,7 +453,7 @@ External links: old URL-in-URL bug, mixed protocols !! input And again with mixed protocols: [ftp://example.com?url=http://example.com link] !! result -

And again with mixed protocols: link (ftp://example.com?url=http://example.com) +

And again with mixed protocols: link

!!end @@ -458,7 +462,7 @@ External links: URL in text !! input URL in text: [http://example.com http://example.com] !! result -

URL in text: http://example.com +

URL in text: http://example.com

!! end @@ -467,7 +471,7 @@ External links: Clickable images !! input ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] !! result -

ja-style clickable images: Ncwikicol.png (http://example.com) +

ja-style clickable images: Ncwikicol.png

!!end @@ -476,7 +480,34 @@ External links: raw ampersand !! input Old & use: http://x&y !! result -

Old & use: http://x&y +

Old & use: http://x&y +

+!! end + +!! test +External links: encoded ampersand +!! input +Old & use: http://x&y +!! result +

Old & use: http://x&y +

+!! end + +!! test +External links: [raw ampersand] +!! input +Old & use: [http://x&y] +!! result +

Old & use: [1] +

+!! end + +!! test +External links: [encoded ampersand] +!! input +Old & use: [http://x&y] +!! result +

Old & use: [1]

!! end @@ -485,7 +516,7 @@ External links: www.jpeg.org (bug 554) !! input http://www.jpeg.org !!result -

http://www.jpeg.org +

http://www.jpeg.org

!! end @@ -494,7 +525,88 @@ External links: URL within URL (original bug 2) !! input [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] !! result -

[1] (http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp) +

[1] +

+!! end + +!! test +BUG 361: URL inside bracketed URL +!! input +[http://www.example.com/foo http://www.example.com/bar] +!! result +

http://www.example.com/bar +

+!! end + +!! test +BUG 361: URL within URL, not bracketed +!! input +http://www.example.com/foo?=http://www.example.com/bar +!! result +

http://www.example.com/foo?=http://www.example.com/bar +

+!! end + +!! test +BUG 289: ">"-token in URL-tail +!! input +http://www.example.com/ +!! result +

http://www.example.com/<hello> +

+!!end + +!! test +BUG 289: literal ">"-token in URL-tail +!! input +http://www.example.com/html +!! result +

http://www.example.com/html +

+!!end + +!! test +BUG 289: ">"-token in bracketed URL +!! input +[http://www.example.com/ stuff] +!! result +

<hello> stuff +

+!!end + +!! test +BUG 289: literal ">"-token in bracketed URL +!! input +[http://www.example.com/html stuff] +!! result +

html stuff +

+!!end + +!! test +BUG 289: literal double quote at end of URL +!! input +http://www.example.com/"hello" +!! result +

http://www.example.com/"hello" +

+!!end + +!! test +BUG 289: literal double quote in bracketed URL +!! input +[http://www.example.com/"hello" stuff] +!! result +

"hello" stuff +

+!!end + +!! test +External links: invalid character +!! input +[http://www.example.com test] +!! result +

[http://www.example.com test]

!! end @@ -552,8 +664,36 @@ Normal text. ### ### Tables ### -### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables +### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables ### + +# This should not produce
as
+# is the bare minimun required by the spec, see: +# http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables +!! test +A table with no data. +!! input +{||} +!! result +!! end + +# A table with nothing but a caption is invalid XHTML, we might want to render +# this as

caption

+!! test +A table with nothing but a caption +!! input +{| +|+ caption +|} +!! result + + + +
caption +
+
+!! end + !! test Simple table !! input @@ -563,11 +703,11 @@ Simple table | 3 || 4 |} !! result - - +
+ - +
1 2
3 4
@@ -600,26 +740,26 @@ Multiplication table - + - + - + - + - + - +
Multiplication table
× 1 2 3
1 1 2 3
2 2 4 6
3 3 6 9
4 4 8 12
5 5 10 15
@@ -638,13 +778,13 @@ Table rowspan | Cell 3, row 2 |} !! result - - +
+ - +
Cell 1, row 1 - Cell 2, row 1 (and 2) + Cell 2, row 1 (and 2) Cell 3, row 1
Cell 1, row 2 Cell 3, row 2
@@ -665,15 +805,15 @@ Nested table |the original table again |} !! result - - +
+
α - - +
+ - +
nested
table
the original table again @@ -681,6 +821,21 @@ Nested table !! end +!! test +Invalid attributes in table cell (bug 1830) +!! input +{| +|Cell:|broken +|} +!! result + + +
broken +
+ +!! end + + ### ### Internal links ### @@ -756,6 +911,15 @@ Piped link with 3 brackets

!! end +!! test +Link with multiple pipes +!! input +[[Main Page|The|Main|Page]] +!! result +

The|Main|Page +

+!! end + !! test Link to namespaces !! input @@ -783,13 +947,39 @@ Link containing }

!! end +!! test +Link containing % (not as a hex sequence) +!! input +[[7% Solution]] +!! result +

7% Solution +

+!! end + +!! test +Link containing % as a single hex sequence interpreted to char +!! input +[[7%25 Solution]] +!! result +

7% Solution +

+!!end + +!! test +Link containing % as a double hex sequence interpreted to hex sequence +!! input +[[7%2525 Solution]] +!! result +

[[7%2525 Solution]] +

+!!end !! test Plain link to URL !! input [[http://www.example.org]] !! result -

[[1] (http://www.example.org)] +

[[1]]

!! end @@ -809,7 +999,7 @@ Piped link to URL !! input Piped link to URL: [[http://www.example.org|an example URL]] !! result -

Piped link to URL: [example URL (http://www.example.org|an)] +

Piped link to URL: [example URL]

!! end @@ -822,9 +1012,39 @@ BUG 2: [[page|http://url/]] should link to page, not http://url/

!! end +!! test +BUG 337: Escaped self-links should be bold +!! options +title=[[Bug462]] +!! input +[[Bug462]] [[Bug462]] +!! result +

Bug462 Bug462 +

+!! end + +!! test +Self-link to section should not be bold +!! options +title=[[Main Page]] +!! input +[[Main Page#section]] +!! result +

Main Page#section +

+!! end + +!! test + inside a link +!! input +[[Main Page]] [[Main Page|the main page [it's not very good]]] +!! result +

Main Page the main page [it's not very good] +

+!! end ### -### Interwiki links +### Interwiki links (see maintenance/interwiki.sql) ### !! test @@ -832,10 +1052,22 @@ Inline interwiki link !! input [[MeatBall:SoftSecurity]] !! result -

MeatBall:SoftSecurity +

MeatBall:SoftSecurity

!! end +!! test +Interwiki link encoding conversion (bug 1636) +!! input +*[[Wikipedia:ro:Olteniţa]] +*[[Wikipedia:ro:Olteniţa]] +!! result + + +!! end + ## ## XHTML tidiness ### @@ -849,6 +1081,41 @@ Inline interwiki link

!! end +!! test +Incorrecly removing closing slashes from correctly formed XHTML +!! input +
+!! result +


+

+!! end + +!! test +Failing to transform badly formed HTML into correct XHTML +!! input +
+
+
+!! result +


+
+
+

+!!end + +!! test +Horizontal ruler (should it add that extra space?) +!! input +
+
+foo
bar +!! result +
+
+foo
bar +!! end + ### ### Block-level elements ### @@ -956,7 +1223,7 @@ RFC 822 !! end !! test -Magic links: ISBN +Magic links: ISBN (bug 1937 unresolved) !! input ISBN 0-306-40615-2 !! result @@ -964,6 +1231,15 @@ ISBN 0-306-40615-2

!! end +!! test +Magic links: PMID incorrectly converts space to underscore +!! input +PMID 1234 +!! result +

PMID 1234 +

+!! end + ### ### Templates #### @@ -1039,8 +1315,8 @@ BUG 553: link with two variables in a piped link |[[{{{1}}}|{{{2}}}]] |} !! result - - +
+
[[{{{1}}}|{{{2}}}]]
@@ -1119,7 +1395,7 @@ Template infinite loop !! input {{loop1}} !! result -

{{loop2}} +

{{loop1}}

!! end @@ -1149,11 +1425,11 @@ foo {{table}} !! result

foo

- - +
+ - +
1 2
3 4
@@ -1167,11 +1443,11 @@ foo !! result

foo

- - +
+ - +
1 2
3 4
@@ -1275,6 +1551,57 @@ pst This is a test template with parameter "something else" !! end + +!! article +Template:nowikitest +!! text +'''not wiki''' +!! endarticle + +!! test +pre-save transform: nowiki in subst (bug 1188) +!! options +pst +!! input +{{subst:nowikitest}} +!! result +'''not wiki''' +!! end + + +!! article +Template:commenttest +!! text +This template has in it. +!! endarticle + +!! test +pre-save transform: comment in subst (bug 1936) +!! options +pst +!! input +{{subst:commenttest}} +!! result +This template has in it. +!! end + + +!! article +Template:dangerous +!!text +Oh no +!!endarticle + +!!test +(confirming safety of fix for subst bug 1936) +!! input +{{Template:dangerous}} +!! result +

Oh no +

+!! end + + ### ### Message transform tests ### @@ -1304,27 +1631,27 @@ msg !! test Simple image !! input -[[Image: test]] +[[Image:foobar.jpg]] !! result -

Image: test +

Image:foobar.jpg

!! end !! test Right-aligned image !! input -[[Image:test|right]] +[[Image:foobar.jpg|right]] !! result -
right
+
!! end !! test Image with caption !! input -[[Image:test|right|Caption text]] +[[Image:foobar.jpg|right|Caption text]] !! result -
Caption text
+
Caption text
!! end @@ -1333,7 +1660,7 @@ Image with frame and link !! input [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]] !! result -
This is a test image
This is a test image Main Page
+
This is a test image Main Page
This is a test image Main Page
!! end @@ -1347,31 +1674,81 @@ Link to image page !! end !! test -Image caption with a free URL +Frameless image caption with a free URL !! input -[[Image:foo|http://example.com]] +[[Image:foobar.jpg|http://example.com]] !! result -

http://example.comhttp://example.com +

http://example.com

!! end !! test Thumbnail image caption with a free URL !! input -[[Image:foo|thumb|http://example.com]] +[[Image:foobar.jpg|thumb|http://example.com]] +!! result + + +!! end + +# Pending resolution to bug 368 +!! test +BUG 648: Frameless image caption with a link +!! input +[[Image:foobar.jpg|text with a [[link]] in it]] +!! result +

text with a link in it +

+!! end + +!! test +Escape HTML special chars in image alt text +!! input +[[Image:foobar.jpg|& < > "]] !! result -
Missing image
Foo
+

& < > " +

!! end !! test -Image caption with a link +BUG 499: Alt text should have Ӓ, not &1234; !! input -[[Image:foo|text with a [[link]] in it]] +[[Image:foobar.jpg|♀]] !! result -

text with a link in it +

♀

!! end +!! test +Broken image caption with link +!! input +[[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link. +!! result +

[[Image:Foobar.jpg|thumb|This is a broken caption. But this is just an ordinary link. +

+!! end + +!! test +Image caption containing another image +!! input +[[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]] +!! result +
This is a caption with another Image:Icon.png inside it!
Enlarge
This is a caption with another Image:Icon.png inside it!
+ +!! end + +!! test +Image caption containing a newline +!! input +[[Image:Foobar.jpg|This +*is some text]] +!! result +

This *is some text +

+!!end + + + ### ### Subpages ### @@ -1471,6 +1848,8 @@ es:Alimento fr:Nourriture zh:食品 ### !! test Basic section headings +!! options +title=[[Parser test script]] !! input == Headline 1 == Some text @@ -1493,6 +1872,8 @@ Blah blah !! test Section headings with TOC +!! options +title=[[Parser test script]] !! input == Headline 1 == === Subheadline 1 === @@ -1503,29 +1884,29 @@ Section headings with TOC Some text ===Another headline=== !! result -
-Table of contents
- - - - +

Table of contents

+
+

Headline 1

Subheadline 1

Skipping a level
@@ -1537,14 +1918,75 @@ Some text !! end +# perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10' +!! test +Handling of sections up to level 6 and beyond +!! input += Level 1 Heading= +== Level 2 Heading== +=== Level 3 Heading=== +==== Level 4 Heading==== +===== Level 5 Heading===== +====== Level 6 Heading====== +======= Level 7 Heading======= +======== Level 8 Heading======== +========= Level 9 Heading========= +========== Level 10 Heading========== +!! result +

Table of contents

+ +
+

+

+

Level 1 Heading

+

Level 2 Heading

+

Level 3 Heading

+

Level 4 Heading

+
Level 5 Heading
+
Level 6 Heading
+
= Level 7 Heading=
+
== Level 8 Heading==
+
=== Level 9 Heading===
+
==== Level 10 Heading====
+ +!! end + !! test Resolving duplicate section names +!! options +title=[[Parser test script]] !! input == Foo bar == -==Foo bar== +== Foo bar == !! result

Foo bar

-

Foo bar

+

Foo bar

!! end @@ -1557,7 +1999,8 @@ Template:sections !! test Template with sections, __NOTOC__ -!! options title=[[Parser test script]] +!! options +title=[[Parser test script]] !! input __NOTOC__ ==Section 0== @@ -1583,10 +2026,248 @@ __NOEDITSECTION__ !! end +!! test +Link inside a section heading +!! options +title=[[Parser test script]] +!! input +==Section with a [[Main Page|link]] in it== +!! result +

Section with a link in it

+ +!! end + + +!! test +Bug 1219 URL next to image (good) +!! input +http://example.com [[Image:foobar.jpg]] +!! result +

http://example.com Image:foobar.jpg +

+!!end + +!! test +Bug 1219 URL next to image (broken) +!! input +http://example.com[[Image:foobar.jpg]] +!! result +

http://example.comImage:foobar.jpg +

+!!end + +!! test +Bug 1186 news: in the middle of text +!! input +http://en.wikinews.org/wiki/Wikinews:Workplace +!! result +

http://en.wikinews.org/wiki/Wikinews:Workplace +

+!!end + + +!! test +Namespaced link must have a title +!! input +[[Project:]] +!! result +

[[Project:]] +

+!!end + +!! test +Namespaced link must have a title (bad fragment version) +!! input +[[Project:#fragment]] +!! result +

[[Project:#fragment]] +

+!!end + + +!! test +div with no attributes +!! input +
HTML rocks
+!! result +
HTML rocks
+ +!! end + +!! test +div with double-quoted attribute +!! input +
HTML rocks
+!! result +
HTML rocks
+ +!! end + +!! test +div with single-quoted attribute +!! input +
HTML rocks
+!! result +
HTML rocks
+ +!! end + +!! test +div with unquoted attribute +!! input +
HTML rocks
+!! result +
HTML rocks
+ +!! end + +!! test +div with illegal double attributes +!! input +
HTML rocks
+!! result +
HTML rocks
+ +!!end + +!! test +DIV IN UPPERCASE +!! input +
HTML ROCKS
+!! result +
HTML ROCKS
+ +!!end + + +!! test +text with amp in the middle of nowhere +!! input +Remember AT&T? +!!result +

Remember AT&T? +

+!! end + +!! test +text with character entity: eacute +!! input +I always thought é was a cute letter. +!! result +

I always thought é was a cute letter. +

+!! end + +!! test +text with undefined character entity: xacute +!! input +I always thought &xacute; was a cute letter. +!! result +

I always thought &xacute; was a cute letter. +

+!! end + + +### +### Media links +### + +!! test +Media link +!! input +[[Media:Foobar.jpg]] +!! result +

Media:Foobar.jpg +

+!! end + +!! test +Media link with text +!! input +[[Media:Foobar.jpg|A neat file to look at]] +!! result +

A neat file to look at +

+!! end + +# FIXME: this is still bad HTML tag nesting +!! test +Media link with nasty text +!! input +[[Media:Foobar.jpg|Safe Link
" onmouseover="alert(document.cookie)" onfoo="
]] +!! result +

Safe Link

+

+!! end + + +!! test +Character reference normalization in link text (bug 1938) +!! input +[[Main Page|this&that]] +!! result +

this&that +

+!!end + +!! test +Empty attribute crash test (bug 2067) +!! input +foo +!! result +

foo +

+!! end + +!! test +Empty attribute crash test single-quotes (bug 2067) +!! input +foo +!! result +

foo +

+!! end + +!! test +Attribute test: equals, then nothing +!! input +foo +!! result +

foo +

+!! end + +!! test +Attribute test: unquoted value +!! input +foo +!! result +

foo +

+!! end + +!! test +Attribute test: unquoted but illegal value (hash) +!! input +foo +!! result +

foo +

+!! end + +!! test +Attribute test: no value +!! input +foo +!! result +

foo +

+!! end + + TODO: more images more tables math character entities and much more -