From 7eea23984cc60bcc859f8d40324972fdda6aacef Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 8 Jan 2006 10:33:28 +0000 Subject: [PATCH] * More tests, two of which fail * Two tests for hex sequences in links, one of which fails * moved all the XSS tests to one place * More & improved parser hook tests --- maintenance/parserTests.txt | 264 +++++++++++++++++++++++++++--------- 1 file changed, 197 insertions(+), 67 deletions(-) diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 5409f2b15b..bf2d8c49ab 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -16,6 +16,7 @@ # 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 # @@ -218,6 +219,51 @@ 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 ### @@ -1013,6 +1059,24 @@ Link containing % as a double hex sequence interpreted to hex sequence

!!end +!! test +Link containing "#<" and "#>" % as a hex sequences +!! input +[[%23%3c]][[%23%3e]] +!! result +

[[%23%3c]][[%23%3e]] +

+!! end + +!! test +Link containing "<#" and ">#" as a hex sequences +!! input +[[%3c%23]][[%3e%23]] +!! result +

[[%3c%23]][[%3e%23]] +

+!! end + !! test Plain link to URL !! input @@ -2778,6 +2842,7 @@ Bug 2304: HTML attribute safety (bold) !! end + !! test Bug 2304: HTML attribute safety (ISBN) !! input @@ -2841,7 +2906,6 @@ Bug 3244: HTML attribute safety (extension; unsafe) !! end - !! test Math section safety when disabled !! input @@ -2851,6 +2915,44 @@ Math section safety when disabled

!! end +# More MSIE fun discovered by Tom Gilder + +!! test +MSIE CSS safety test: spurious slash +!! input +
evil
+!! result +
evil
+ +!! end + +!! test +MSIE CSS safety test: hex code +!! input +
evil
+!! result +
evil
+ +!! end + +!! test +MSIE CSS safety test: comment in url +!! input +
evil
+!! result +
evil
+ +!! end + +!! test +MSIE CSS safety test: comment in expression +!! input +
evil4
+!! result +
evil4
+ +!! end + !! test Table attribute legitimate extension @@ -2881,13 +2983,32 @@ Table attribute safety !! end ### -### Parser hooks +### Parser hooks (see maintenance/parserTestsParserHook.php for the extension) ### !! test Parser hook: empty input !! input !! result +
+string(0) ""
+array(0) {
+}
+
+ +!! end + +!! test +Parser hook: empty input using terminated empty elements +!! input + +!! result +
+NULL
+array(0) {
+}
+
+ !! end !! test @@ -2895,17 +3016,55 @@ Parser hook: basic input !! input input !! result -

input -

+
+string(5) "input"
+array(0) {
+}
+
+ !! end + !! test Parser hook: case insensetive !! input +input +!! result +
+string(5) "input"
+array(0) {
+}
+
+ +!! end + + +!! test +Parser hook: case insensetive, redux +!! input input !! result -

input -

+
+string(5) "input"
+array(0) {
+}
+
+ +!! end + +!! test +Parser hook: nested tags +!! options +noxml +!! input + +!! result +
+string(5) ""
+array(0) {
+}
+
</tag> + !! end !! test @@ -2914,13 +3073,17 @@ Parser hook: basic arguments !! result
-Array
-(
-    [width] => 200
-    [height] => 100
-    [depth] => 50
-    [square] => square
-)
+string(0) ""
+array(4) {
+  ["width"]=>
+  string(3) "200"
+  ["height"]=>
+  string(3) "100"
+  ["depth"]=>
+  string(2) "50"
+  ["square"]=>
+  string(6) "square"
+}
 
!! end @@ -2931,12 +3094,13 @@ Parser hook: empty input using terminated empty elements (bug 2374) text !! result
-Array
-(
-    [foo] => bar
-)
-
-text +NULL +array(1) { + ["foo"]=> + string(3) "bar" +} +text + !! end #
should be output literally since there is no matching tag that begins it @@ -2948,17 +3112,21 @@ other stuff
!! result
-Array
-(
-    [width] => 200
-    [height] => 100
-    [depth] => 50
-    [square] => square
-)
+NULL
+array(4) {
+  ["width"]=>
+  string(3) "200"
+  ["height"]=>
+  string(3) "100"
+  ["depth"]=>
+  string(2) "50"
+  ["square"]=>
+  string(6) "square"
+}
 
-other stuff -
- +

other stuff +</tag> +

!! end @@ -2987,44 +3155,6 @@ Nested template calls !! end -# More MSIE fun discovered by Tom Gilder - -!! test -MSIE CSS safety test: spurious slash -!! input -
evil
-!! result -
evil
- -!! end - -!! test -MSIE CSS safety test: hex code -!! input -
evil
-!! result -
evil
- -!! end - -!! test -MSIE CSS safety test: comment in url -!! input -
evil
-!! result -
evil
- -!! end - -!! test -MSIE CSS safety test: comment in expression -!! input -
evil4
-!! result -
evil4
- -!! end - ### ### Sanitizer ### -- 2.20.1