Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -1049,9 +1049,10 @@ |
1050 | 1050 | /** |
1051 | 1051 | * Steal a callback function from the primary parser, save it for |
1052 | 1052 | * application to our scary parser. If the hook is not installed, |
1053 | | - * die a painful dead to warn the others. |
| 1053 | + * abort processing of this file. |
1054 | 1054 | * |
1055 | 1055 | * @param $name String |
| 1056 | + * @return Bool true if tag hook is present |
1056 | 1057 | */ |
1057 | 1058 | public function requireHook( $name ) { |
1058 | 1059 | global $wgParser; |
— | — | @@ -1059,16 +1060,19 @@ |
1060 | 1061 | if ( isset( $wgParser->mTagHooks[$name] ) ) { |
1061 | 1062 | $this->hooks[$name] = $wgParser->mTagHooks[$name]; |
1062 | 1063 | } else { |
1063 | | - wfDie( "This test suite requires the '$name' hook extension.\n" ); |
| 1064 | + echo " This test suite requires the '$name' hook extension, skipping.\n"; |
| 1065 | + return false; |
1064 | 1066 | } |
| 1067 | + return true; |
1065 | 1068 | } |
1066 | 1069 | |
1067 | 1070 | /** |
1068 | 1071 | * Steal a callback function from the primary parser, save it for |
1069 | 1072 | * application to our scary parser. If the hook is not installed, |
1070 | | - * die a painful dead to warn the others. |
| 1073 | + * abort processing of this file. |
1071 | 1074 | * |
1072 | 1075 | * @param $name String |
| 1076 | + * @return Bool true if function hook is present |
1073 | 1077 | */ |
1074 | 1078 | public function requireFunctionHook( $name ) { |
1075 | 1079 | global $wgParser; |
— | — | @@ -1076,8 +1080,10 @@ |
1077 | 1081 | if ( isset( $wgParser->mFunctionHooks[$name] ) ) { |
1078 | 1082 | $this->functionHooks[$name] = $wgParser->mFunctionHooks[$name]; |
1079 | 1083 | } else { |
1080 | | - wfDie( "This test suite requires the '$name' function hook extension.\n" ); |
| 1084 | + echo " This test suite requires the '$name' function hook extension, skipping.\n"; |
| 1085 | + return false; |
1081 | 1086 | } |
| 1087 | + return true; |
1082 | 1088 | } |
1083 | 1089 | |
1084 | 1090 | /* |
— | — | @@ -1657,7 +1663,9 @@ |
1658 | 1664 | foreach ( explode( "\n", $data['hooks'] ) as $line ) { |
1659 | 1665 | $line = trim( $line ); |
1660 | 1666 | if ( $line ) { |
1661 | | - if ( $this->parser ) $this->parser->requireHook( $line ); |
| 1667 | + if ( $this->parser && !$this->parser->requireHook( $line ) ) { |
| 1668 | + return false; |
| 1669 | + } |
1662 | 1670 | } |
1663 | 1671 | } |
1664 | 1672 | $data = array(); |
— | — | @@ -1671,7 +1679,9 @@ |
1672 | 1680 | foreach ( explode( "\n", $data['functionhooks'] ) as $line ) { |
1673 | 1681 | $line = trim( $line ); |
1674 | 1682 | if ( $line ) { |
1675 | | - if ( $this->parser ) $this->parser->requireFunctionHook( $line ); |
| 1683 | + if ( $this->parser && !$this->parser->requireFunctionHook( $line ) ) { |
| 1684 | + return false; |
| 1685 | + } |
1676 | 1686 | } |
1677 | 1687 | } |
1678 | 1688 | $data = array(); |
Index: trunk/extensions/ParserFunctions/ParserFunctions.php |
— | — | @@ -46,6 +46,7 @@ |
47 | 47 | $wgExtensionMessagesFiles['ParserFunctionsMagic'] = dirname(__FILE__) . '/ParserFunctions.i18n.magic.php'; |
48 | 48 | |
49 | 49 | $wgParserTestFiles[] = dirname( __FILE__ ) . "/funcsParserTests.txt"; |
| 50 | +$wgParserTestFiles[] = dirname( __FILE__ ) . "/stringFunctionTests.txt"; |
50 | 51 | |
51 | 52 | function wfSetupParserFunctions() { |
52 | 53 | global $wgPFHookStub, $wgHooks; |
Index: trunk/extensions/ParserFunctions/funcsParserTests.txt |
— | — | @@ -175,17 +175,3 @@ |
176 | 176 | <p>false |
177 | 177 | </p> |
178 | 178 | !! end |
179 | | - |
180 | | -!! test |
181 | | -#urldecode |
182 | | -!! input |
183 | | -{{#urldecode:}} |
184 | | -{{#urldecode:foo%20bar}} |
185 | | -{{#urldecode:%D0%9C%D0%B5%D0%B4%D0%B8%D0%B0%D0%92%D0%B8%D0%BA%D0%B8}} |
186 | | -{{#urldecode: some unescaped string}} |
187 | | -!! result |
188 | | -<p>foo bar |
189 | | -МедиаВики |
190 | | -some unescaped string |
191 | | -</p> |
192 | | -!! end |
Index: trunk/extensions/ParserFunctions/stringFunctionTests.txt |
— | — | @@ -0,0 +1,32 @@ |
| 2 | +# @todo expand |
| 3 | +!! functionhooks |
| 4 | +len |
| 5 | +!! endfunctionhooks |
| 6 | + |
| 7 | +!! test |
| 8 | +#len |
| 9 | +!! input |
| 10 | +{{#len:}} |
| 11 | +{{#len:0}} |
| 12 | +{{#len:test}} |
| 13 | +!!result |
| 14 | +<p>0 |
| 15 | +1 |
| 16 | +4 |
| 17 | +</p> |
| 18 | +!! end |
| 19 | + |
| 20 | +!! test |
| 21 | +#urldecode |
| 22 | +!! input |
| 23 | +{{#urldecode:}} |
| 24 | +{{#urldecode:foo%20bar}} |
| 25 | +{{#urldecode:%D0%9C%D0%B5%D0%B4%D0%B8%D0%B0%D0%92%D0%B8%D0%BA%D0%B8}} |
| 26 | +{{#urldecode: some unescaped string}} |
| 27 | +!! result |
| 28 | +<p>foo bar |
| 29 | +МедиаВики |
| 30 | +some unescaped string |
| 31 | +</p> |
| 32 | +!! end |
| 33 | + |
Property changes on: trunk/extensions/ParserFunctions/stringFunctionTests.txt |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 34 | + native |