summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Array/of/does-not-use-prototype-properties.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/of/does-not-use-prototype-properties.js')
-rw-r--r--js/src/tests/test262/built-ins/Array/of/does-not-use-prototype-properties.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/of/does-not-use-prototype-properties.js b/js/src/tests/test262/built-ins/Array/of/does-not-use-prototype-properties.js
new file mode 100644
index 0000000000..6f08da1f92
--- /dev/null
+++ b/js/src/tests/test262/built-ins/Array/of/does-not-use-prototype-properties.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2015 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.
+/*---
+esid: sec-array.of
+es6id: 22.1.2.3
+description: Array.of does not use prototype properties for arguments.
+info: |
+ It defines elements rather than assigning to them.
+---*/
+
+Object.defineProperty(Array.prototype, "0", {
+ set: function(v) {
+ throw new Test262Error('Should define own properties');
+ }
+});
+
+var arr = Array.of(true);
+assert.sameValue(arr[0], true, 'The value of arr[0] is expected to be true');
+
+function Custom() {}
+
+Object.defineProperty(Custom.prototype, "0", {
+ set: function(v) {
+ throw new Test262Error('Should define own properties');
+ }
+});
+
+var custom = Array.of.call(Custom, true);
+assert.sameValue(custom[0], true, 'The value of custom[0] is expected to be true');
+
+reportCompare(0, 0);