From: Brion Vibber Date: Mon, 5 Jun 2006 20:36:01 +0000 (+0000) Subject: Add some basic regression tests on extraction for section editing X-Git-Tag: 1.31.0-rc.0~56893 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=99065954770acfdfe94ff4d5446b7aa9606c8c3e;p=lhc%2Fweb%2Fwiklou.git Add some basic regression tests on extraction for section editing --- diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index 9c98a6113a..22ddb8d564 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -269,6 +269,9 @@ class ParserTest { $out = $parser->preSaveTransform( $input, $title, $user, $options ); } elseif (preg_match('/\\bmsg\\b/i', $opts)) { $out = $parser->transformMsg( $input, $options ); + } elseif( preg_match( '/\\bsection=(\d+)\b/', $opts, $matches ) ) { + $section = intval( $matches[1] ); + $out = Article::getSection( $input, $section ); } else { $output = $parser->parse( $input, $title, $options, true, true, 1337 ); $out = $output->getText(); diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 2de4bdc81c..d2070d739e 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -4424,6 +4424,246 @@ Special page transclusion twice (bug 5021) !! end +!! test +Invalid header with following text +!! input += x = y +!! result +

= x = y +

+!! end + + +!! test +Section extraction test (section 0) +!! options +section=0 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +start +!! end + +!! test +Section extraction test (section 1) +!! options +section=1 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +==a== +===aa=== +====aaa==== +!! end + +!! test +Section extraction test (section 2) +!! options +section=2 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +===aa=== +====aaa==== +!! end + +!! test +Section extraction test (section 3) +!! options +section=3 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +====aaa==== +!! end + +!! test +Section extraction test (section 4) +!! options +section=4 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +==b== +===ba=== +===bb=== +====bba==== +===bc=== +!! end + +!! test +Section extraction test (section 5) +!! options +section=5 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +===ba=== +!! end + +!! test +Section extraction test (section 6) +!! options +section=6 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +===bb=== +====bba==== +!! end + +!! test +Section extraction test (section 7) +!! options +section=7 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +====bba==== +!! end + +!! test +Section extraction test (section 8) +!! options +section=8 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +===bc=== +!! end + +!! test +Section extraction test (section 9) +!! options +section=9 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +==c== +===ca=== +!! end + +!! test +Section extraction test (section 10) +!! options +section=10 +!! input +start +==a== +===aa=== +====aaa==== +==b== +===ba=== +===bb=== +====bba==== +===bc=== +==c== +===ca=== +!! result +===ca=== +!! end + + # # #