summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_5/Object/15.2.3.14-01.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_5/Object/15.2.3.14-01.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_5/Object/15.2.3.14-01.js')
-rw-r--r--js/src/tests/ecma_5/Object/15.2.3.14-01.js92
1 files changed, 92 insertions, 0 deletions
diff --git a/js/src/tests/ecma_5/Object/15.2.3.14-01.js b/js/src/tests/ecma_5/Object/15.2.3.14-01.js
new file mode 100644
index 000000000..81ab3fe38
--- /dev/null
+++ b/js/src/tests/ecma_5/Object/15.2.3.14-01.js
@@ -0,0 +1,92 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 307791;
+var summary = 'ES5 Object.keys(O)';
+var actual = '';
+var expect = '';
+
+printBugNumber(BUGNUMBER);
+printStatus(summary);
+
+function arraysEqual(a1, a2)
+{
+ return a1.length === a2.length &&
+ a1.every(function(v, i) { return v === a2[i]; });
+}
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+assertEq(Object.keys.length, 1);
+
+var o, keys;
+
+o = { a: 3, b: 2 };
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["a", "b"]), true,
+ "" + keys);
+
+o = { get a() { return 17; }, b: 2 };
+keys = Object.keys(o),
+assertEq(arraysEqual(keys, ["a", "b"]), true,
+ "" + keys);
+
+o = { __iterator__: function() { return Iterator({a: 2, b: 3}); } };
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["__iterator__"]), true,
+ "" + keys);
+
+o = { a: 1, b: 2 };
+delete o.a;
+o.a = 3;
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["b", "a"]), true,
+ "" + keys);
+
+o = [0, 1, 2];
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["0", "1", "2"]), true,
+ "" + keys);
+
+o = /./.exec("abc");
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["0", "index", "input"]), true,
+ "" + keys);
+
+o = { a: 1, b: 2, c: 3 };
+delete o.b;
+o.b = 5;
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["a", "c", "b"]), true,
+ "" + keys);
+
+function f() { }
+f.prototype.p = 1;
+o = new f();
+o.g = 1;
+keys = Object.keys(o);
+assertEq(arraysEqual(keys, ["g"]), true,
+ "" + keys);
+
+if (typeof Namespace !== "undefined" && typeof QName !== "undefined")
+{
+ var o2 = {};
+ var qn = new QName(new Namespace("foo"), "v");
+ o2.f = 1;
+ o2[qn] = 3;
+ o2.baz = 4;
+ var keys2 = Object.keys(o2);
+ assertEq(arraysEqual(keys2, ["f", "foo::v", "baz"]), true,
+ "" + keys2);
+}
+
+/******************************************************************************/
+
+reportCompare(expect, actual, "Object.keys");
+
+printStatus("All tests passed!");