Add some test cases involving Symbol.iterator as a prelude to
bug 918828. no_r=me, testonly.
--- 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);