Index: test/mjsunit/es6/array-of-4.js |
diff --git a/test/mjsunit/es6/array-of-4.js b/test/mjsunit/es6/array-of-4.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..254845dc0bd72db72151ca4cc42e24a370b48d7c |
--- /dev/null |
+++ b/test/mjsunit/es6/array-of-4.js |
@@ -0,0 +1,23 @@ |
+// Copyright 2014 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// Based on: https://hg.mozilla.org/mozilla-central/file/d0c3168c3c47/js/src/jit-test/tests/collections/Array-of-4.js |
+ |
+// Flags: --harmony-arrays |
+ |
+ |
+// Array.of does not trigger prototype setters. |
+ |
+// (It defines elements rather than assigning to them.) |
+ |
+var status = "pass"; |
+Object.defineProperty(Array.prototype, "0", {set: function(v) {status = "FAIL 1"}}); |
+assertEquals(Array.of(1)[0], 1); |
+assertEquals(status, "pass"); |
+ |
+function Bag() {} |
+Bag.of = Array.of; |
+Object.defineProperty(Bag.prototype, "0", {set: function(v) {status = "FAIL 2"}}); |
+assertEquals(Bag.of(1)[0], 1); |
+assertEquals(status, "pass"); |