Add tests for bug 600392, which was fixed by a backout in bug 599159. r=testingonlychange
authorJeff Walden <jwalden@mit.edu>
Wed, 22 Dec 2010 21:32:02 -0500
changeset 59936 02d096c1a578d21cb44df73787d46b9e0c2d5936
parent 59935 95b952a9d46fd5dc34d031cb424ba11458ad90ae
child 59937 1c8d8360b90dbf1d4ffbf782c13c7eede72b5199
push id17820
push usercleary@mozilla.com
push dateTue, 04 Jan 2011 21:40:57 +0000
treeherdermozilla-central@969691cfe40e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestingonlychange
bugs600392, 599159
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Add tests for bug 600392, which was fixed by a backout in bug 599159. r=testingonlychange
js/src/tests/ecma_5/Array/jstests.list
js/src/tests/ecma_5/Array/length-01.js
--- a/js/src/tests/ecma_5/Array/jstests.list
+++ b/js/src/tests/ecma_5/Array/jstests.list
@@ -1,6 +1,7 @@
 url-prefix ../../jsreftest.html?test=ecma_5/Array/
+script length-01.js
+script regress-599159.js
 script sort-01.js
+script toLocaleString-01.js
 script toString-01.js
-script toLocaleString-01.js
-script regress-599159.js
 script unshift-01.js
new file mode 100644
--- /dev/null
+++ b/js/src/tests/ecma_5/Array/length-01.js
@@ -0,0 +1,71 @@
+/*
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/licenses/publicdomain/
+ * Contributor:
+ *   Jeff Walden <jwalden+code@mit.edu>
+ */
+
+//-----------------------------------------------------------------------------
+var BUGNUMBER = 600392;
+var summary =
+  'Object.preventExtensions([]).length = 0 should do nothing, not throw';
+
+print(BUGNUMBER + ": " + summary);
+
+/**************
+ * BEGIN TEST *
+ **************/
+
+
+function testEmpty()
+{
+  var a = [];
+  assertEq(a.length, 0);
+  assertEq(Object.preventExtensions(a), a);
+  assertEq(a.length, 0);
+  a.length = 0;
+  assertEq(a.length, 0);
+}
+testEmpty();
+
+function testEmptyStrict()
+{
+  "use strict";
+  var a = [];
+  assertEq(a.length, 0);
+  assertEq(Object.preventExtensions(a), a);
+  assertEq(a.length, 0);
+  a.length = 0;
+  assertEq(a.length, 0);
+}
+testEmptyStrict();
+
+function testNonEmpty()
+{
+  var a = [1, 2, 3];
+  assertEq(a.length, 3);
+  assertEq(Object.preventExtensions(a), a);
+  assertEq(a.length, 3);
+  a.length = 0;
+  assertEq(a.length, 0);
+}
+testNonEmpty();
+
+function testNonEmptyStrict()
+{
+  "use strict";
+  var a = [1, 2, 3];
+  assertEq(a.length, 3);
+  assertEq(Object.preventExtensions(a), a);
+  assertEq(a.length, 3);
+  a.length = 0;
+  assertEq(a.length, 0);
+}
+testNonEmptyStrict();
+
+/******************************************************************************/
+
+if (typeof reportCompare === "function")
+  reportCompare(true, true);
+
+print("All tests passed!");