Bug 1343043 - Part 1: Remove some global variables from shell.js and instead declare them locally in tests. r=shu
authorAndré Bargull <andre.bargull@gmail.com>
Mon, 27 Feb 2017 13:51:39 -0800
changeset 374351 36040e95313752e6862dec18a18036785baf21c2
parent 374350 bf500219a0fc2686ef6c669cedf6b7b0d15fb0d4
child 374352 83854fc82f3d96aed2c2fbda01a60023811020ef
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshu
bugs1343043
milestone54.0a1
Bug 1343043 - Part 1: Remove some global variables from shell.js and instead declare them locally in tests. r=shu
js/src/tests/Intl/NumberFormat/significantDigitsOfZero.js
js/src/tests/ecma_6/Comprehensions/error-messages.js
js/src/tests/ecma_6/Generators/shell.js
js/src/tests/ecma_7/TypedObject/atopbuffer.js
js/src/tests/ecma_7/TypedObject/atopbufferwithoffset.js
js/src/tests/ecma_7/TypedObject/storageopaque.js
js/src/tests/js1_7/regress/regress-414553.js
js/src/tests/js1_8_5/regress/regress-355569.js
js/src/tests/shell.js
--- a/js/src/tests/Intl/NumberFormat/significantDigitsOfZero.js
+++ b/js/src/tests/Intl/NumberFormat/significantDigitsOfZero.js
@@ -20,17 +20,19 @@ var testData = [
     {minimumSignificantDigits: 3, maximumSignificantDigits: 5, expected: "0.00"},
 ];
 
 for (var i = 0; i < testData.length; i++) {
     var min = testData[i].minimumSignificantDigits;
     var max = testData[i].maximumSignificantDigits;
     var options = {minimumSignificantDigits: min, maximumSignificantDigits: max};
     var format = new Intl.NumberFormat("en-US", options);
-    assertEq(format.format(0), testData[i].expected,
+    var actual = format.format(0);
+    var expected = testData[i].expected;
+    assertEq(actual, expected,
              "Wrong formatted string for 0 with " +
              "minimumSignificantDigits " + min +
              ", maximumSignificantDigits " + max +
              ": expected \"" + expected +
              "\", actual \"" + actual + "\"");
 }
 
 reportCompare(true, true);
--- a/js/src/tests/ecma_6/Comprehensions/error-messages.js
+++ b/js/src/tests/ecma_6/Comprehensions/error-messages.js
@@ -125,16 +125,18 @@ function expectSuccess(err, msg) {
   reportCompare(null, err, 'parse: ' + msg);
 }
 
 function atTop(str) { return str }
 function inFun(str) { return '(function(){' + str + '})' }
 function inGen(str) { return '(function*(){' + str + '})' }
 function inGenExp(str) { return '(for (y of ' + str + ') y)' }
 
+var summary = '';
+
 function test()
 {
   enterFunc ('test');
   printBugNumber(BUGNUMBER);
   printStatus (summary);
 
   for (var i = 0, len = cases.length; i < len; i++) {
     var expr, top, fun, gen, genexp, desc;
--- a/js/src/tests/ecma_6/Generators/shell.js
+++ b/js/src/tests/ecma_6/Generators/shell.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 function assertFalse(a) { assertEq(a, false) }
 function assertTrue(a) { assertEq(a, true) }
-function assertNotEq(found, not_expected) { assertFalse(found === expected) }
+function assertNotEq(found, not_expected) { assertEq(Object.is(found, not_expected), false) }
 function assertIteratorResult(result, value, done) {
     assertDeepEq(result.value, value);
     assertEq(result.done, done);
 }
 function assertIteratorNext(iter, value) {
     assertIteratorResult(iter.next(), value, false);
 }
 function assertIteratorDone(iter, value) {
--- a/js/src/tests/ecma_7/TypedObject/atopbuffer.js
+++ b/js/src/tests/ecma_7/TypedObject/atopbuffer.js
@@ -1,10 +1,11 @@
 // |reftest| skip-if(!this.hasOwnProperty("TypedObject"))
 var BUGNUMBER = 898356;
+var summary = "";
 
 var {StructType, uint32, Object, Any, storage, objectType} = TypedObject;
 
 function main() { // once a C programmer, always a C programmer.
   print(BUGNUMBER + ": " + summary);
 
   var Uints = new StructType({f: uint32, g: uint32});
 
--- a/js/src/tests/ecma_7/TypedObject/atopbufferwithoffset.js
+++ b/js/src/tests/ecma_7/TypedObject/atopbufferwithoffset.js
@@ -1,10 +1,11 @@
 // |reftest| skip-if(!this.hasOwnProperty("TypedObject"))
 var BUGNUMBER = 898356;
+var summary = "";
 
 var {StructType, uint32, Object, Any, storage, objectType} = TypedObject;
 
 function main() { // once a C programmer, always a C programmer.
   print(BUGNUMBER + ": " + summary);
 
   var Uints = new StructType({f: uint32, g: uint32});
 
--- a/js/src/tests/ecma_7/TypedObject/storageopaque.js
+++ b/js/src/tests/ecma_7/TypedObject/storageopaque.js
@@ -1,10 +1,11 @@
 // |reftest| skip-if(!this.hasOwnProperty("TypedObject"))
 var BUGNUMBER = 898356;
+var summary = "";
 
 var {StructType, uint32, Object, Any, storage, objectType} = TypedObject;
 
 function main() { // once a C programmer, always a C programmer.
   print(BUGNUMBER + ": " + summary);
 
   var Uints = new StructType({f: uint32, g: uint32});
   var uints = new Uints({f: 0, g: 1});
--- a/js/src/tests/js1_7/regress/regress-414553.js
+++ b/js/src/tests/js1_7/regress/regress-414553.js
@@ -1,15 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 //-----------------------------------------------------------------------------
 var BUGNUMBER = 414553;
+var summary = '';
+
 printBugNumber(BUGNUMBER);
 printStatus(summary);
 
 var expected = '1,2,3,4';
 
 let a = 1, [b,c] = [2,3], d = 4;
 var actual = String([a,b,c,d]);
 
--- a/js/src/tests/js1_8_5/regress/regress-355569.js
+++ b/js/src/tests/js1_8_5/regress/regress-355569.js
@@ -2,16 +2,17 @@
 
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 var bug = 355569;
 var actual = '';
 var expect = '';
+var summary = '';
 
 printBugNumber (bug);
 printStatus (summary);
 
 var targetAddress = 0x12030010;
 var sprayParams = {
   chunkSize: 16 * 1024 * 1024,
   chunkCount: 16,
--- a/js/src/tests/shell.js
+++ b/js/src/tests/shell.js
@@ -789,21 +789,16 @@
 
 var STATUS = "STATUS: ";
 
 var gDelayTestDriverEnd = false;
 var gFailureExpected = false;
 
 var gTestcases = new Array();
 var gTc = gTestcases.length;
-var summary = '';
-var description = '';
-var expected = '';
-var actual = '';
-var msg = '';
 
 /*
  * constant strings
  */
 var GLOBAL = this + '';
 
 var DESCRIPTION;
 var EXPECTED;