Cscott has uploaded a new change for review. https://gerrit.wikimedia.org/r/50622
Change subject: Honor language=xx option in parserTests.txt (for wt2html). ...................................................................... Honor language=xx option in parserTests.txt (for wt2html). This patch implements the language=xx option in parserTests for wt2html. This exposes some failures in l10n. In particular, the tests are now run in the 'en' prefix by default (as thay are in the PHP parser tests), and the 'en' prefix currently has some issues with linktrail and linkprefix. A bug in the WikitextSerializer is also exposed in the "Simple category in language variants" test case, which doesn't properly normalize the category link name when the locale is set. Change-Id: Ibb925ecdfe848b43e46ff97b29c5bddcdb02e9c8 --- M js/tests/parserTests.js 1 file changed, 23 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Parsoid refs/changes/22/50622/1 diff --git a/js/tests/parserTests.js b/js/tests/parserTests.js index fd9fbfe..51dcefd 100644 --- a/js/tests/parserTests.js +++ b/js/tests/parserTests.js @@ -515,7 +515,7 @@ cb( null, content, changelist ); }; -ParserTests.prototype.convertWt2Html = function( mode, wikitext, processHtmlCB ) { +ParserTests.prototype.convertWt2Html = function( mode, prefix, variant, wikitext, processHtmlCB ) { try { this.parserPipeline.once( 'document', function ( doc ) { // processHtmlCB can be asynchronous, so deep-clone @@ -528,7 +528,24 @@ processHtmlCB( e ); } this.env.page.src = wikitext; - this.parserPipeline.process( wikitext ); + this.env.switchToConfig( prefix, function( err ) { + if ( err ) { + processHtmlCB( err ); + } else { + // TODO: set language variant + // adjust config to match that used for PHP tests + this.env.conf.wiki.server = 'http://Britney-Spears'; + this.env.conf.wiki.wgScriptPath = '/'; + this.env.conf.wiki.script = '/index.php'; + this.env.conf.wiki.articlePath = '/wiki/$1'; + // this has been updated in the live wikis, but the parser tests + // expect the old value. + this.env.conf.wiki.interwikiMap.meatball.url = + 'http://www.usemod.com/cgi-bin/mb.pl?$1'; + // convert this wikitext! + this.parserPipeline.process( wikitext ); + } + }.bind(this)); }; /** @@ -553,6 +570,8 @@ } item.time = {}; + var prefix = (item.options || {}).language || 'en'; + var variant = (item.options || {}).variant; // Build a list of tasks for this test that will be passed to async.waterfall var finishHandler = function ( err, res ) { @@ -601,7 +620,7 @@ // First conversion stage if ( startsAtWikitext ) { if ( item.cachedHTML === null ) { - testTasks.push( this.convertWt2Html.bind( this, mode, item.input ) ); + testTasks.push( this.convertWt2Html.bind( this, mode, prefix, variant, item.input ) ); } else { testTasks.push( function ( cb ) { cb( null, item.cachedHTML.cloneNode( true ) ); @@ -642,7 +661,7 @@ if ( mode === 'wt2wt' || mode === 'selser' ) { testTasks.push( this.convertHtml2Wt.bind( this, options, mode, item ) ); } else if ( mode === 'html2html' ) { - testTasks.push( this.convertWt2Html.bind( this, mode ) ); + testTasks.push( this.convertWt2Html.bind( this, mode, prefix, variant ) ); } // Processing stage -- To view, visit https://gerrit.wikimedia.org/r/50622 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibb925ecdfe848b43e46ff97b29c5bddcdb02e9c8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Parsoid Gerrit-Branch: master Gerrit-Owner: Cscott <wikime...@cscott.net> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits