add parser test case for bug 5757
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 29 Apr 2006 22:50:13 +0000 (22:50 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 29 Apr 2006 22:50:13 +0000 (22:50 +0000)
test cases can now use 'language=xx' option

RELEASE-NOTES
maintenance/parserTests.inc
maintenance/parserTests.txt

index 0757894..fa8fe1b 100644 (file)
@@ -147,6 +147,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Cleaned up formatNum usage in langfiles
 * (bug 5716) Warn when a user tries to upload a file which was previously deleted
 * (bug 5565) Add a class attribute to the table on Special:Allpages
+* "lang=xx" option for parser test cases to set content language
+
 
 == Compatibility ==
 
index 12e7dc8..e16be32 100644 (file)
@@ -290,6 +290,14 @@ class ParserTest {
                if( !isset( $this->uploadDir ) ) {
                        $this->uploadDir = $this->setupUploadDir();
                }
+               
+               if( preg_match( '/language=([a-z]+(?:_[a-z]+)?)/', $opts, $m ) ) {
+                       $lang = $m[1];
+               } else {
+                       $lang = 'en';
+               }
+               $langClass = 'Language' . str_replace( '-', '_', ucfirst( $lang ) );
+               $langObj = setupLangObj( $langClass );
 
                $settings = array(
                        'wgServer' => 'http://localhost',
@@ -302,13 +310,13 @@ class ParserTest {
                        'wgStyleSheetPath' => '/skins',
                        'wgSitename' => 'MediaWiki',
                        'wgServerName' => 'Britney Spears',
-                       'wgLanguageCode' => 'en',
-                       'wgContLanguageCode' => 'en',
+                       'wgLanguageCode' => $lang,
+                       'wgContLanguageCode' => $lang,
                        'wgDBprefix' => 'parsertest_',
                        'wgDefaultUserOptions' => array(),
 
-                       'wgLang' => new LanguageUtf8(),
-                       'wgContLang' => new LanguageUtf8(),
+                       'wgLang' => $langObj,
+                       'wgContLang' => $langObj,
                        'wgNamespacesWithSubpages' => array( 0 => preg_match('/\\bsubpage\\b/i', $opts)),
                        'wgMaxTocLevel' => 999,
                        'wgCapitalLinks' => true,
index ddd1232..b692b08 100644 (file)
@@ -18,6 +18,7 @@
 #      subpage         enable subpages (disabled by default)
 #      noxml           don't check for XML well formdness
 #      title=[[XXX]]   run test using article title XXX
+#   language=XXX       set content language to XXX for this test
 #      disabled        do not run test
 #
 # For testing purposes, temporary articles can created:
@@ -3754,6 +3755,27 @@ disabled
 Something, but defenetly not <br id="9" />...
 !! end
 
+!! test
+Language converter: output gets cut off unexpectedly (bug 5757)
+!! options
+language=zh
+!! input
+this bit is safe: }-
+
+but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
+
+then we get cut off here: }-
+
+all additional text is vanished
+!! result
+<p>this bit is safe: }-
+</p><p>but if we add a conversion instance: xxx
+</p><p>then we get cut off here: }-
+</p><p>all additional text is vanished
+</p>
+!! end
+
+
 TODO:
 more images
 more tables