From: Brion Vibber Date: Mon, 20 Jul 2009 00:20:33 +0000 (+0000) Subject: Add support for running test cases on the Linker::formatComment() mini-parser, so... X-Git-Tag: 1.31.0-rc.0~40825 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=6349a32c32b91a6aee896e3dbbb34e70a648b44b;p=lhc%2Fweb%2Fwiklou.git Add support for running test cases on the Linker::formatComment() mini-parser, so we can protect against behavior regressions there. --- diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index 214e7fed28..182c5c7fc1 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -443,6 +443,7 @@ class ParserTest { } $noxml = (bool)preg_match( '~\\b noxml \\b~x', $opts ); + $local = (bool)preg_match( '~\\b local \\b~x', $opts ); $parser = $this->getParser(); $title =& Title::makeTitle( NS_MAIN, $titleText ); @@ -458,6 +459,9 @@ class ParserTest { $section = $matches[1]; $replace = $matches[2]; $out = $parser->replaceSection( $input, $section, $replace ); + } elseif( preg_match( '/\\bcomment\\b/i', $opts ) ) { + $linker = $user->getSkin(); + $out = $linker->formatComment( $input, $title, $local ); } else { $output = $parser->parse( $input, $title, $options, true, true, 1337 ); $out = $output->getText(); diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt index 12fb4590c8..a2d0ab52b3 100644 --- a/maintenance/parserTests.txt +++ b/maintenance/parserTests.txt @@ -21,6 +21,8 @@ # language=XXX set content language to XXX for this test # variant=XXX set the variant of language for this test (eg zh-tw) # disabled do not run test +# comment run through Linker::formatComment() instead of main parser +# local format section links in edit comment text as local links # # For testing purposes, temporary articles can created: # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle @@ -7342,6 +7344,41 @@ Leading > blockquote syntax # # +# +# Edit comments +# + +!! test +Edit comment with link +!! options +comment +!! input +I like the [[Main Page]] a lot +!! result +I like the Main Page a lot +!!end + +!! test +Edit comment with section link (non-local, eg in history list) +!! options +comment,title=[[Main Page]] +!! input +/* External links */ removed bogus entries +!! result +→External links: removed bogus entries +!!end + +!! test +Edit comment with section link (local, eg in diff view) +!! options +comment,local,title=[[Main Page]] +!! input +/* External links */ removed bogus entries +!! result +→External links: removed bogus entries +!!end + + TODO: more images more tables