From e5a26f346000dc45b53b3204a69f825a52bbf943 Mon Sep 17 00:00:00 2001 From: Platonides Date: Sun, 1 May 2011 21:33:16 +0000 Subject: [PATCH] Convert r86795 tests into a dataProvider --- .../includes/parser/PreprocessorTest.php | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/phpunit/includes/parser/PreprocessorTest.php b/tests/phpunit/includes/parser/PreprocessorTest.php index d6fc376740..1cee8aea81 100644 --- a/tests/phpunit/includes/parser/PreprocessorTest.php +++ b/tests/phpunit/includes/parser/PreprocessorTest.php @@ -137,5 +137,55 @@ class PreprocessorTest extends MediaWikiTestCase { $this->markTestIncomplete( "File $expectedFilename missing. Output stored as $tempFilename" ); } } + + /** + * Tests from Bug 28642 · https://bugzilla.wikimedia.org/28642 + */ + function provideHeadings() { + return array( /* These should become headings: */ + array( "== h ==", "== h ==<!--c1-->" ), + array( "== h == ", "== h == <!--c1-->" ), + array( "== h == ", "== h ==<!--c1--> " ), + array( "== h == ", "== h == <!--c1--> " ), + array( "== h ==", "== h ==<!--c1--><!--c2-->" ), + array( "== h == ", "== h == <!--c1--><!--c2-->" ), + array( "== h == ", "== h ==<!--c1--><!--c2--> " ), + array( "== h == ", "== h == <!--c1--><!--c2--> " ), + array( "== h == ", "== h == <!--c1--> <!--c2-->" ), + array( "== h == ", "== h ==<!--c1--> <!--c2--> " ), + array( "== h == ", "== h == <!--c1--> <!--c2--> " ), + array( "== h ==", "== h ==<!--c1--><!--c2--><!--c3-->" ), + array( "== h == ", "== h ==<!--c1--> <!--c2--><!--c3-->" ), + array( "== h == ", "== h ==<!--c1--><!--c2--> <!--c3-->" ), + array( "== h == ", "== h ==<!--c1--> <!--c2--> <!--c3-->" ), + array( "== h == ", "== h == <!--c1--><!--c2--><!--c3-->" ), + array( "== h == ", "== h == <!--c1--> <!--c2--><!--c3-->" ), + array( "== h == ", "== h == <!--c1--><!--c2--> <!--c3-->" ), + array( "== h == ", "== h == <!--c1--> <!--c2--> <!--c3-->" ), + array( "== h == ", "== h ==<!--c1--><!--c2--><!--c3--> " ), + array( "== h == ", "== h ==<!--c1--> <!--c2--><!--c3--> " ), + array( "== h == ", "== h ==<!--c1--><!--c2--> <!--c3--> " ), + array( "== h == ", "== h ==<!--c1--> <!--c2--> <!--c3--> " ), + array( "== h == ", "== h == <!--c1--><!--c2--><!--c3--> " ), + array( "== h == ", "== h == <!--c1--> <!--c2--><!--c3--> " ), + array( "== h == ", "== h == <!--c1--><!--c2--> <!--c3--> " ), + array( "== h == ", "== h == <!--c1--> <!--c2--> <!--c3--> " ), + + /* These are not working: */ + array( "== h == ", "== h ==<!--c1--> <!--c2-->" ), + array( "== h == ", "== h == <!--c1--> <!--c2-->" ), + array( "== h == ", "== h ==<!--c1--> <!--c2--> " ), + array( "== h == x ", "== h == x <!--c1--><!--c2--><!--c3--> " ), + array( "== h == x ", "== h ==<!--c1--> x <!--c2--><!--c3--> " ), + array( "== h == x ", "== h ==<!--c1--><!--c2--><!--c3--> x " ), + ); + } + + /** + * @dataProvider provideHeadings + */ + function testHeadings( $wikiText, $expectedXml ) { + $this->assertEquals( $expectedXml, $this->mPreprocessor->preprocessToXml( $wikiText ) ); + } } -- 2.20.1