jenkins-bot has submitted this change and it was merged.
Change subject: Honor language=xx option in parserTests.txt
......................................................................
Honor language=xx option in parserTests.txt
This patch implements the language=xx option in parserTests for
wt2html. This may expose 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 linktrail and linkprefix for 'en' become
significant. 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, 25 insertions(+), 4 deletions(-)
Approvals:
MarkTraceur: Looks good to me, approved
jenkins-bot: Verified
diff --git a/js/tests/parserTests.js b/js/tests/parserTests.js
index 7fdaa83..547a2c1 100644
--- a/js/tests/parserTests.js
+++ b/js/tests/parserTests.js
@@ -518,7 +518,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
@@ -531,7 +531,26 @@
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
+ // see core/tests/parser/parserTest.inc:setupGlobals()
for
+ // full set of config normalizations done.
+ this.env.conf.wiki.server = 'http://example.org';
+ 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 (as set in
parserTest.inc:setupDatabase())
+ 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));
};
/**
@@ -556,6 +575,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 ) {
@@ -604,7 +625,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 ) );
@@ -645,7 +666,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: merged
Gerrit-Change-Id: Ibb925ecdfe848b43e46ff97b29c5bddcdb02e9c8
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits