jenkins-bot has submitted this change and it was merged.

Change subject: Fix ParserTests.js --numchanges
......................................................................


Fix ParserTests.js --numchanges

We were using the same seed for the PRNG for each change, resulting in the
same change N times, instead of N different random changes.

Change-Id: I8dc7c37192d0fc9d82580cd821d97efb807a9f90
---
M js/tests/parserTests.js
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  MarkTraceur: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/js/tests/parserTests.js b/js/tests/parserTests.js
index 65f63d4..6ae2402 100755
--- a/js/tests/parserTests.js
+++ b/js/tests/parserTests.js
@@ -489,7 +489,7 @@
  */
 ParserTests.prototype.makeChanges = function ( item, content, changelist, cb ) 
{
        // Seed the random-number generator based on the item title
-       var random = new alea(item.title);
+       var random = new alea( (item.seed || '') + (item.title || '') );
 
        cb = cb || function () {};
        var initContent = content;
@@ -567,7 +567,7 @@
  */
 ParserTests.prototype.generateChanges = function ( options, nonRandomChanges, 
item, content, cb ) {
        // Seed the random-number generator based on the item title
-       var random = new alea( item.seed || item.title );
+       var random = new alea( (item.seed || '') + (item.title || '') );
 
        // This function won't actually change anything, but it will add change
        // markers to random elements.
@@ -1361,6 +1361,7 @@
                                tasks.push( function ( modeIndex, changesIndex 
) {
                                        return function ( cb ) {
                                                var newitem = Util.clone( item 
);
+                                               newitem.seed = changesIndex + 
'';
                                                newitem.changes = 
item.changes[changesIndex];
                                                newitem.otherChanges = 
item.changes;
                                                this.processTest( newitem, 
options, modes[modeIndex], function () {

-- 
To view, visit https://gerrit.wikimedia.org/r/59168
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8dc7c37192d0fc9d82580cd821d97efb807a9f90
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: 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

Reply via email to