From: Bartosz DziewoĆski
Date: Sun, 2 Nov 2014 20:08:43 +0000 (+0100)
Subject: Parser tests for page status indicators
X-Git-Tag: 1.31.0-rc.0~11944^2
X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=302e9e48f647918ea2a21108a63b32bd2b2f9286;p=lhc%2Fweb%2Fwiklou.git
Parser tests for page status indicators
https://www.mediawiki.org/wiki/Help:Page_status_indicators
Change-Id: Ic461fe889a3f8ef9f332019f72cfb732c0ec1eca
---
diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc
index e18c22b709..1cffa20c09 100644
--- a/tests/parser/parserTest.inc
+++ b/tests/parser/parserTest.inc
@@ -643,6 +643,14 @@ class ParserTest {
$out = "$title\n$out";
}
+ if ( isset( $opts['showindicators'] ) ) {
+ $indicators = '';
+ foreach ( $output->getIndicators() as $id => $content ) {
+ $indicators .= "$id=$content\n";
+ }
+ $out = $indicators . $out;
+ }
+
if ( isset( $opts['ill'] ) ) {
$out = implode( ' ', $output->getLanguageLinks() );
} elseif ( isset( $opts['cat'] ) ) {
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index c65e8d7ba5..2b7f4cdb04 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -26,6 +26,7 @@
# php php-only test (not run by the parsoid parser unless
# the test includes an html/parsoid section)
# showtitle make the first line the title
+# showindicators make the first lines the page status indicators
# comment run through Linker::formatComment() instead of main parser
# local format section links in edit comment text as local links
# notoc disable table of contents
@@ -19143,6 +19144,82 @@ this is not the the title
!! end
+!! test
+Page status indicators: Empty name is invalid
+!! options
+showindicators
+!! wikitext
+
+
+!! html
+Error: Page status indicators' name
attribute must not be empty.
+Error: Page status indicators' name
attribute must not be empty.
+
+!! end
+
+!! test
+Page status indicators: Weird syntaxes that are okay
+!! options
+showindicators
+!! wikitext
+
+
+!! html
+empty=
+name=
+
+
+!! end
+
+!! test
+Page status indicators: Torture test
+!! options
+showindicators
+!! wikitext
+hello world
+[[Main Page]]
+[[File:Foobar.jpg|25px|link=]]
+[[File:Foobar.jpg|25px]]
+* foo
+* bar
+foo
+ Preformatted
+Broken tag
+
{| class=wikitable
+| cell
+|}
+
Two
+
+paragraphs
+!! html
+01=hello world
+02=
Main Page
+03=
![Foobar.jpg](http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg)
+04=
![Foobar.jpg](http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg)
+05=
+
+06=foo
+07=
Preformatted
+
+08=
Broken tag
+
+09=
+
+10=
Two
+
paragraphs
+
+
+
+
+
+
+
+!! end
+
!! test
preload: check
and
!! options
diff --git a/tests/phpunit/includes/parser/NewParserTest.php b/tests/phpunit/includes/parser/NewParserTest.php
index ccd7f96220..91aad10c02 100644
--- a/tests/phpunit/includes/parser/NewParserTest.php
+++ b/tests/phpunit/includes/parser/NewParserTest.php
@@ -771,6 +771,14 @@ class NewParserTest extends MediaWikiTestCase {
$out = "$title\n$out";
}
+ if ( isset( $opts['showindicators'] ) ) {
+ $indicators = '';
+ foreach ( $output->getIndicators() as $id => $content ) {
+ $indicators .= "$id=$content\n";
+ }
+ $out = $indicators . $out;
+ }
+
if ( isset( $opts['ill'] ) ) {
$out = implode( ' ', $output->getLanguageLinks() );
} elseif ( isset( $opts['cat'] ) ) {