# MediaWiki Parser test cases # Some taken from http://meta.wikimedia.org/wiki/Parser_testing # All (C) their respective authors and released under the GPL # # The syntax should be fairly self-explanatory. # # Currently supported test options: # One of the following three: # # (default) generate HTML output # pst apply pre-save transform # msg apply message transform # # Plus any combination of these: # # cat add category links # ill add inter-language links # subpage enable subpages (disabled by default) # noxml don't check for XML well formdness # title=[[XXX]] run test using article title XXX # disabled do not run test # # For testing purposes, temporary articles can created: # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle # where '/' denotes a newline. # This is the standard article assumed to exist. !! article Main Page !! text blah blah !! endarticle ### ### Basic tests ### !! test Blank input !! input !! result !! end !! test Simple paragraph !! input This is a simple paragraph. !! result
This is a simple paragraph.
!! end !! test Simple list !! input * Item 1 * Item 2 !! result* This is not an unordered list item.
!! end !! testLorem ipsum dolor sed abit. sed nullum. :and a colon
!! end !! test nowiki 3 !! input :There is not nowiki. :There isasdf!! end !! test Comment test 2 !! input asdf jkl !! result
asdf jkl
!! end !! test Comment test 3 !! input asdf jkl !! resultasdf jkl
!! end !! test Comment test 4 !! input asdfjkl !! resultasdfjkl
!! end !! test Comment spacing !! input a b c !! resulta
b
c
!! end !! test Comment whitespace !! input !! result !! end !! test Comment semantics and delimiters !! input !! result !! end !! test Comment semantics and delimiters, redux !! input !! result !! end !! test Comment semantics and delimiters: directors cut !! input --> !! result-->
!! end !! test Comment semantics: nesting !! input --> !! result-->
!! end ### ### Preformatted text ### !! test Preformatted text !! input This is some Preformatted text With ''italic'' And '''bold''' And a [[Main Page|link]] !! resultThis is some Preformatted text With italic And bold And a link!! end ### ### Definition lists ### !! test Simple definition !! input ; name : Definition !! result
Non-bracketed: http://example.com
!! end !! test External links: numbered !! input Numbered: [http://example.com] Numbered: [http://example.net] Numbered: [http://example.org] !! resultNumbered: [1] Numbered: [2] Numbered: [3]
!!end !! test External links: specified text !! input Specified text: [http://example.com link] !! resultSpecified text: link
!!end !! test External links: trail !! input Linktrails should not work for external links: [http://example.com link]s !! resultLinktrails should not work for external links: links
!! end !! test External links: dollar sign in URL !! input http://example.com/1$2345 !! result !! end !! test External links: dollar sign in URL (named) !! input [http://example.com/1$2345] !! result !!end !! test External links: open square bracket forbidden in URL (bug 4377) !! input http://example.com/1[2345 !! resulthttp://example.com/1[2345
!! end !! test External links: open square bracket forbidden in URL (named) (bug 4377) !! input [http://example.com/1[2345] !! result !!end !! test External image !! input External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png !! resultExternal image:
!! end !! test External image from https !! input External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png !! resultExternal image from https:
!! end !! test Link to non-http image, no img tag !! input Link to non-http image, no img tag: ftp://example.com/test.jpg !! resultLink to non-http image, no img tag: ftp://example.com/test.jpg
!! end !! test External links: terminating separator !! input Terminating separator: http://example.com/thing, !! resultTerminating separator: http://example.com/thing,
!! end !! test External links: intervening separator !! input Intervening separator: http://example.com/1,2,3 !! resultIntervening separator: http://example.com/1,2,3
!! end !! test External links: old bug with URL in query !! input Old bug with URL in query: [http://example.com/thing?url=http://example.com link] !! resultOld bug with URL in query: link
!! end !! test External links: old URL-in-URL bug, mixed protocols !! input And again with mixed protocols: [ftp://example.com?url=http://example.com link] !! resultAnd again with mixed protocols: link
!!end !! test External links: URL in text !! input URL in text: [http://example.com http://example.com] !! resultURL in text: http://example.com
!! end !! test External links: Clickable images !! input ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png] !! result !!end !! test External links: raw ampersand !! input Old & use: http://x&y !! resultOld & use: http://x&y
!! end !! test External links: encoded ampersand !! input Old & use: http://x&y !! resultOld & use: http://x&y
!! end !! test External links: [raw ampersand] !! input Old & use: [http://x&y] !! resultOld & use: [1]
!! end !! test External links: [encoded ampersand] !! input Old & use: [http://x&y] !! resultOld & use: [1]
!! end !! test External links: www.jpeg.org (bug 554) !! input http://www.jpeg.org !!result !! end !! test External links: URL within URL (original bug 2) !! input [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp] !! result !! end !! test BUG 361: URL inside bracketed URL !! input [http://www.example.com/foo http://www.example.com/bar] !! result !! end !! test BUG 361: URL within URL, not bracketed !! input http://www.example.com/foo?=http://www.example.com/bar !! resulthttp://www.example.com/foo?=http://www.example.com/bar
!! end !! test BUG 289: ">"-token in URL-tail !! input http://www.example.com/http://www.example.com/<hello>
!!end !! test BUG 289: literal ">"-token in URL-tail !! input http://www.example.com/html !! result !!end !! test BUG 289: ">"-token in bracketed URL !! input [http://www.example.com/http://www.example.com/"hello"
!!end !! test BUG 289: literal double quote in bracketed URL !! input [http://www.example.com/"hello" stuff] !! result !!end !! test External links: invalid character !! input [http://www.example.com test] !! result