From b44b25dac32f948783c4d326dfd947215e9494a5 Mon Sep 17 00:00:00 2001
From: Wil Mahan
Date: Fri, 24 Sep 2004 04:24:01 +0000
Subject: [PATCH] Add blurb at top; enable template as link source test now
that it works; be more careful with some trailing newlines; add four table
tests, a template infinite loop test, etc.
---
maintenance/parserTests.txt | 216 ++++++++++++++++++++++++++++++++++--
1 file changed, 209 insertions(+), 7 deletions(-)
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 6103348f2f..17370eef16 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -1,6 +1,23 @@
# MediaWiki Parser test cases
-# see also http://meta.wikimedia.org/wiki/Parser_testing
+# 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:
+# (default) generate HTML output
+# pst apply pre-save transform
+# msg apply message transform
+#
+# Tests can be disabled with the '!!disabled' flag.
+#
+# For testing purposes, temporary articles can created:
+# !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
+# where '/' denotes a newline.
+###
+### Basic tests
+###
!! test
Blank input
!! input
@@ -25,6 +42,7 @@ Simple list
+
!! end
!! test
@@ -60,6 +78,7 @@ Italics and bold
plainboldbold-italicplain
plain l'italicplain
+
!! end
###
@@ -117,6 +136,7 @@ nowiki 3
- There is not nowiki.
- There is nowiki.
+
!! end
###
@@ -130,6 +150,7 @@ comment test 1
!! result
asdf
+
!! end
!! test
@@ -373,6 +394,138 @@ Normal text.
!! end
+###
+### Tables
+###
+### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
+###
+!! test
+Simple table
+!! input
+{|
+| 1 || 2
+|-
+| 3 || 4
+|}
+!! result
+
+
+!! end
+
+!! test
+Multiplication table
+!! input
+{| border="1" cellpadding="2"
+|+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
+|}
+!! result
+
+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
+ |
+
+!! end
+
+!! test
+Table rowspan
+!! input
+{| align=right border=1
+| Cell 1, row 1
+|rowspan=2| Cell 2, row 1 (and 2)
+| Cell 3, row 1
+|-
+| Cell 1, row 2
+| Cell 3, row 2
+|}
+!! result
+
+
+ Cell 1, row 1
+ | Cell 2, row 1 (and 2)
+ | Cell 3, row 1
+ |
+
+ Cell 1, row 2
+ | Cell 3, row 2
+ |
+
+!! end
+
+!! test
+Nested table
+!! input
+{| border=1
+| α
+|
+{| bgcolor=#ABCDEF border=2
+|nested
+|-
+|table
+|}
+|the original table again
+|}
+!! result
+
+
+ α
+ |
+
+ | the original table again
+ |
+
+!! end
+
###
### Internal links
###
@@ -572,6 +725,7 @@ Common list
item 2
item 3
+
!! end
!! test
@@ -585,6 +739,7 @@ Numbered list
item 2
item 3
+
!! end
!! test
@@ -626,6 +781,7 @@ Mixed list
Level 1
+
!! end
###
@@ -728,20 +884,56 @@ Magic variable as template parameter
!! article
Template:linktest
!! text
-[[{{{param}}}|foo]]
+[[{{{param}}}|link]]
!! endarticle
-XXX this works outside of parser testing
!! test
-!! disabled
Template parameter as link source
!! input
{{linktest|param=Main Page}}
!! result
+link
+
+!! end
+
+
+!! article
+Template:Linktest2
+!! text
+Main Page
+!! endarticle
+
+!! test
+Template as link source
+!! input
+[[{{linktest2}}]]
+!! result
Main Page
!! end
+!! article
+Template:loop1
+!! text
+{{loop2}}
+!! endarticle
+
+!! article
+Template:loop2
+!! text
+{{loop1}}
+!! endarticle
+
+!! test
+Template infinite loop
+!! input
+{{loop1}}
+!! result
+{{loop2}}
+
+!! end
+
+
###
### Pre-save transform tests
###
@@ -765,10 +957,20 @@ PST
{{test}}
!! end
+!! test
+pre-save transform: nonexistant template
+!! options
+PST
+!! input
+{{thistemplatedoesnotexist}}
+!! result
+{{thistemplatedoesnotexist}}
+!! end
+
!! test
pre-save transform: subst magic variables
!! options
-pst
+PST
!! input
{{subst:SITENAME}}
!! result
@@ -789,7 +991,7 @@ MediaWiki
!! end
!! test
-message transform: should transform wiki markup
+message transform: should not transform wiki markup
!! options
msg
!! input
@@ -803,6 +1005,6 @@ more templates
tables
images
subpages
-pre-save transform and message transform checking
+character entities
and much more
--
2.20.1