From: Wil Mahan
Date: Thu, 23 Sep 2004 21:57:58 +0000 (+0000)
Subject: Tests for templates, pre-save transform, message transform.
X-Git-Tag: 1.5.0alpha1~1838
X-Git-Url: http://git.cyclocoop.org//%27http:/jquery.khurshid.com/ifixpng.php/%27?a=commitdiff_plain;h=df424c01c88434de933b1cdd9c8ba97ab8bbe764;p=lhc%2Fweb%2Fwiklou.git
Tests for templates, pre-save transform, message transform.
---
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 35b9b2715b..6103348f2f 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -376,6 +376,12 @@ Normal text.
###
### Internal links
###
+!! article
+Main Page
+!! text
+blah blah
+!! endarticle
+
!! test
Plain link, capitalized
!! input
@@ -466,10 +472,12 @@ Piped link to namespace
!! end
-# NOTE: it is assumed that [[Category:MediaWiki User's Guide]] exists. It may be necessary to
-# create it, because there are no categories in a default MediaWiki installation. Ideally the
-# parser tester could create a category for testing purposes; this may be necessary for
-# templates anyway.
+!! article
+Category:MediaWiki User's Guide
+!! text
+blah
+!! endarticle
+
!! test
Link to category
!! input
@@ -529,6 +537,13 @@ Inline interwiki link
!! end
+###
+### Images
+###
+
+!! test
+[[
+
##
## XHTML tidiness
@@ -640,7 +655,7 @@ Magic links: internal link to RFC
!! test
Magic links: ISBN
!! input
-ISBN 0-306-40615-2
+ISBN 0-306-40615-2
!! result
ISBN 0-306-40615-2
@@ -658,8 +673,136 @@ Nonexistant template
!! end
+###
+### Templates
+####
+!! article
+Template:test
+!! text
+This is a test template
+!! endarticle
+
+!! test
+Simple template
+!! input
+{{test}}
+!! result
+This is a test template
+
+!! end
+
+!! test
+Template with explicit namespace
+!! input
+{{Template:test}}
+!! result
+This is a test template
+
+!! end
+
+
+!! article
+Template:paramtest
+!! text
+This is a test template with parameter {{{param}}}
+!! endarticle
+
+!! test
+Template parameter
+!! input
+{{paramtest|param=foo}}
+!! result
+This is a test template with parameter foo
+
+!! end
+
+!! test
+Magic variable as template parameter
+!! input
+{{paramtest|param={{SITENAME}}}}
+!! result
+This is a test template with parameter MediaWiki
+
+!! end
+
+!! article
+Template:linktest
+!! text
+[[{{{param}}}|foo]]
+!! endarticle
+
+XXX this works outside of parser testing
+!! test
+!! disabled
+Template parameter as link source
+!! input
+{{linktest|param=Main Page}}
+!! result
+Main Page
+
+!! end
+
+###
+### Pre-save transform tests
+###
+!! test
+pre-save transform: subst:
+!! options
+PST
+!! input
+{{subst:test}}
+!! result
+This is a test template
+!! end
+
+!! test
+pre-save transform: normal template
+!! options
+PST
+!! input
+{{test}}
+!! result
+{{test}}
+!! end
+
+!! test
+pre-save transform: subst magic variables
+!! options
+pst
+!! input
+{{subst:SITENAME}}
+!! result
+MediaWiki
+!! end
+
+###
+### Message transform tests
+###
+!! test
+message transform: magic variables
+!! options
+msg
+!! input
+{{SITENAME}}
+!! result
+MediaWiki
+!! end
+
+!! test
+message transform: should transform wiki markup
+!! options
+msg
+!! input
+''test''
+!! result
+''test''
+!! end
+
TODO:
+more templates
+tables
+images
subpages
-templates
+pre-save transform and message transform checking
and much more