Add some test cases involving Symbol.iterator as a prelude to bug 918828. no_r=me, testonly.
authorJason Orendorff <jorendorff@mozilla.com>
Tue, 01 Jul 2014 15:33:48 -0500
changeset 210824 c0d3ea180fe0442d932285e443c1f51d04d97d6a
parent 210823 b2162376e0656484eafa8b61418979084786b347
child 210825 ac0d55e594f1f4ff203eeb4c82f8f995c9c4ae84
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
bugs918828
milestone36.0a1
Add some test cases involving Symbol.iterator as a prelude to bug 918828. no_r=me, testonly.
js/src/tests/ecma_6/Symbol/equality.js
js/src/tests/ecma_6/Symbol/surfaces.js
--- a/js/src/tests/ecma_6/Symbol/equality.js
+++ b/js/src/tests/ecma_6/Symbol/equality.js
@@ -5,17 +5,18 @@ if (typeof Symbol === "function") {
     // Symbol.for returns the same symbol whenever the same argument is passed.
     assertEq(Symbol.for("q") === Symbol.for("q"), true);
 
     // Several distinct Symbol values.
     var symbols = [
         Symbol(),
         Symbol("Symbol.iterator"),
         Symbol("Symbol.iterator"),  // distinct new symbol with the same description
-        Symbol.for("Symbol.iterator")
+        Symbol.for("Symbol.iterator"),
+        Symbol.iterator
     ];
 
     // Distinct symbols are never equal to each other, even if they have the same
     // description.
     for (var i = 0; i < symbols.length; i++) {
         for (var j = i; j < symbols.length; j++) {
             var expected = (i === j);
             assertEq(symbols[i] == symbols[j], expected);
--- a/js/src/tests/ecma_6/Symbol/surfaces.js
+++ b/js/src/tests/ecma_6/Symbol/surfaces.js
@@ -17,15 +17,20 @@ if (typeof Symbol === "function") {
     assertEq(desc.writable, false);
 
     assertEq(Symbol.prototype.constructor, Symbol);
     desc = Object.getOwnPropertyDescriptor(Symbol.prototype, "constructor");
     assertEq(desc.configurable, true);
     assertEq(desc.enumerable, false);
     assertEq(desc.writable, true);
 
+    desc = Object.getOwnPropertyDescriptor(Symbol, "iterator");
+    assertEq(desc.configurable, false);
+    assertEq(desc.enumerable, false);
+    assertEq(desc.writable, false);
+
     assertEq(Symbol.for.length, 1);
     assertEq(Symbol.prototype.toString.length, 0);
     assertEq(Symbol.prototype.valueOf.length, 0);
 }
 
 if (typeof reportCompare === "function")
     reportCompare(0, 0);