From 6349a32c32b91a6aee896e3dbbb34e70a648b44b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 20 Jul 2009 00:20:33 +0000 Subject: [PATCH] Add support for running test cases on the Linker::formatComment() mini-parser, so we can protect against behavior regressions there. --- maintenance/parserTests.inc | 4 ++++ maintenance/parserTests.txt | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) 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 -- 2.20.1