diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/built-ins/Array/isArray | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/isArray')
31 files changed, 458 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-1.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-1.js new file mode 100644 index 0000000000..57a95072e4 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-1.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-0-1 +description: Array.isArray must exist as a function +---*/ + +var f = Array.isArray; + +assert.sameValue(typeof f, "function", 'The value of `typeof f` is expected to be "function"'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-2.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-2.js new file mode 100644 index 0000000000..5de00e3075 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-2.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-0-2 +description: Array.isArray must exist as a function taking 1 parameter +---*/ + +assert.sameValue(Array.isArray.length, 1, 'The value of Array.isArray.length is expected to be 1'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-3.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-3.js new file mode 100644 index 0000000000..a662307ad0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-3.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-0-3 +description: Array.isArray return true if its argument is an Array +---*/ + +assert.sameValue(Array.isArray([]), true, 'Array.isArray([]) must return true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-4.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-4.js new file mode 100644 index 0000000000..7d9c550665 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-4.js @@ -0,0 +1,16 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +description: Array.isArray return false if its argument is not an Array +---*/ + +assert.sameValue(Array.isArray(42), false, 'Array.isArray(42) must return false'); +assert.sameValue(Array.isArray(undefined), false, 'Array.isArray(undefined) must return false'); +assert.sameValue(Array.isArray(true), false, 'Array.isArray(true) must return false'); +assert.sameValue(Array.isArray("abc"), false, 'Array.isArray("abc") must return false'); +assert.sameValue(Array.isArray({}), false, 'Array.isArray({}) must return false'); +assert.sameValue(Array.isArray(null), false, 'Array.isArray(null) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-5.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-5.js new file mode 100644 index 0000000000..6af24845a8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-5.js @@ -0,0 +1,14 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-0-5 +description: > + Array.isArray return true if its argument is an Array + (Array.prototype) +---*/ + +assert.sameValue(Array.isArray(Array.prototype), true, 'Array.isArray(Array.prototype) must return true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-6.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-6.js new file mode 100644 index 0000000000..3af98c17bc --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-6.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-0-6 +description: Array.isArray return true if its argument is an Array (new Array()) +---*/ + +assert.sameValue(Array.isArray(new Array(10)), true, 'Array.isArray(new Array(10)) must return true'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-7.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-7.js new file mode 100644 index 0000000000..93c0e27bab --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-7.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-0-7 +description: Array.isArray returns false if its argument is not an Array +---*/ + +assert.sameValue(Array.isArray({}), false, 'Array.isArray({}) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-1.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-1.js new file mode 100644 index 0000000000..d39c16f00f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-1.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-1 +description: Array.isArray applied to boolean primitive +---*/ + +assert.sameValue(Array.isArray(true), false, 'Array.isArray(true) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-10.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-10.js new file mode 100644 index 0000000000..d70ca88894 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-10.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-10 +description: Array.isArray applied to RegExp object +---*/ + +assert.sameValue(Array.isArray(new RegExp()), false, 'Array.isArray(new RegExp()) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-11.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-11.js new file mode 100644 index 0000000000..83083bb9a0 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-11.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-11 +description: Array.isArray applied to the JSON object +---*/ + +assert.sameValue(Array.isArray(JSON), false, 'Array.isArray(JSON) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-12.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-12.js new file mode 100644 index 0000000000..b3ce684eba --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-12.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-12 +description: Array.isArray applied to Error object +---*/ + +assert.sameValue(Array.isArray(new SyntaxError()), false, 'Array.isArray(new SyntaxError()) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-13.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-13.js new file mode 100644 index 0000000000..5cb31026cd --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-13.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-13 +description: Array.isArray applied to Arguments object +---*/ + +var arg; + +(function fun() { + arg = arguments; +}(1, 2, 3)); + +assert.sameValue(Array.isArray(arg), false, 'Array.isArray(arguments) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-15.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-15.js new file mode 100644 index 0000000000..6564340b3f --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-15.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-15 +description: Array.isArray applied to the global object +---*/ + +assert.sameValue(Array.isArray(this), false, 'Array.isArray(this) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-2.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-2.js new file mode 100644 index 0000000000..dc13b782a3 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-2.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-2 +description: Array.isArray applied to Boolean Object +---*/ + +assert.sameValue(Array.isArray(new Boolean(false)), false, 'Array.isArray(new Boolean(false)) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-3.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-3.js new file mode 100644 index 0000000000..cbf26a5599 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-3.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-3 +description: Array.isArray applied to number primitive +---*/ + +assert.sameValue(Array.isArray(5), false, 'Array.isArray(5) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-4.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-4.js new file mode 100644 index 0000000000..2df256a118 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-4.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-4 +description: Array.isArray applied to Number object +---*/ + +assert.sameValue(Array.isArray(new Number(-3)), false, 'Array.isArray(new Number(-3)) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-5.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-5.js new file mode 100644 index 0000000000..05d7303288 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-5.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-5 +description: Array.isArray applied to string primitive +---*/ + +assert.sameValue(Array.isArray("abc"), false, 'Array.isArray("abc") must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-6.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-6.js new file mode 100644 index 0000000000..1c2e9d3e18 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-6.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-6 +description: Array.isArray applied to String object +---*/ + +assert.sameValue(Array.isArray(new String("hello\nworld\\!")), false, 'Array.isArray(new String("hello\\nworld\\\\!")) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-7.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-7.js new file mode 100644 index 0000000000..18708528e8 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-7.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-7 +description: Array.isArray applied to Function object +---*/ + +assert.sameValue(Array.isArray(function() {}), false, 'Array.isArray(function() {}) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-8.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-8.js new file mode 100644 index 0000000000..24b0c41a58 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-8.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-8 +description: Array.isArray applied to the Math object +---*/ + +assert.sameValue(Array.isArray(Math), false, 'Array.isArray(Math) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-9.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-9.js new file mode 100644 index 0000000000..869f611895 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-1-9.js @@ -0,0 +1,12 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-1-9 +description: Array.isArray applied to Date object +---*/ + +assert.sameValue(Array.isArray(new Date()), false, 'Array.isArray(new Date()) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-1.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-1.js new file mode 100644 index 0000000000..1592f1a734 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-1.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-2-1 +description: Array.isArray applied to an object with an array as the prototype +---*/ + +var proto = []; +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); + +assert.sameValue(Array.isArray(child), false, 'Array.isArray(new Con()) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-2.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-2.js new file mode 100644 index 0000000000..8bf0e08d26 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-2.js @@ -0,0 +1,20 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-2-2 +description: > + Array.isArray applied to an object with Array.prototype as the + prototype +---*/ + +var proto = Array.prototype; +var Con = function() {}; +Con.prototype = proto; + +var child = new Con(); + +assert.sameValue(Array.isArray(child), false, 'Array.isArray(new Con()) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-3.js b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-3.js new file mode 100644 index 0000000000..b61e821676 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-2-3.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 Ecma International. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es5id: 15.4.3.2-2-3 +description: > + Array.isArray applied to an Array-like object with length and some + indexed properties +---*/ + +assert.sameValue(Array.isArray({ + 0: 12, + 1: 9, + length: 2 +}), false, 'Array.isArray({0: 12, 1: 9, length: 2}) must return false'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/browser.js b/js/src/tests/test262/built-ins/Array/isArray/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/browser.js diff --git a/js/src/tests/test262/built-ins/Array/isArray/descriptor.js b/js/src/tests/test262/built-ins/Array/isArray/descriptor.js new file mode 100644 index 0000000000..1c5c6ef73b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/descriptor.js @@ -0,0 +1,14 @@ +// Copyright 2017 Lyza Danger Gardner. All rights reserved. +// This code is governed by the license found in the LICENSE file. + +/*--- +description: Testing descriptor property of Array.isArray +includes: [propertyHelper.js] +esid: sec-array.isarray +---*/ + +verifyWritable(Array, "isArray"); +verifyNotEnumerable(Array, "isArray"); +verifyConfigurable(Array, "isArray"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/name.js b/js/src/tests/test262/built-ins/Array/isArray/name.js new file mode 100644 index 0000000000..1b2ebb5e42 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/name.js @@ -0,0 +1,29 @@ +// Copyright (C) 2015 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-array.isarray +es6id: 22.1.2.2 +description: > + Array.isArray.name is "isArray". +info: | + Array.isArray ( arg ) + + 17 ECMAScript Standard Built-in Objects: + Every built-in Function object, including constructors, that is not + identified as an anonymous function has a name property whose value + is a String. + + Unless otherwise specified, the name property of a built-in Function + object, if it exists, has the attributes { [[Writable]]: false, + [[Enumerable]]: false, [[Configurable]]: true }. +includes: [propertyHelper.js] +---*/ + +assert.sameValue(Array.isArray.name, "isArray", 'The value of Array.isArray.name is expected to be "isArray"'); + +verifyNotEnumerable(Array.isArray, "name"); +verifyNotWritable(Array.isArray, "name"); +verifyConfigurable(Array.isArray, "name"); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/not-a-constructor.js b/js/src/tests/test262/built-ins/Array/isArray/not-a-constructor.js new file mode 100644 index 0000000000..a72b1eb23e --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/not-a-constructor.js @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-ecmascript-standard-built-in-objects +description: > + Array.isArray does not implement [[Construct]], is not new-able +info: | + ECMAScript Function Objects + + Built-in function objects that are not identified as constructors do not + implement the [[Construct]] internal method unless otherwise specified in + the description of a particular function. + + sec-evaluatenew + + ... + 7. If IsConstructor(constructor) is false, throw a TypeError exception. + ... +includes: [isConstructor.js] +features: [Reflect.construct, arrow-function] +---*/ + +assert.sameValue(isConstructor(Array.isArray), false, 'isConstructor(Array.isArray) must return false'); + +assert.throws(TypeError, () => { + new Array.isArray([]); +}, 'new Array.isArray([]) throws a TypeError exception'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/proxy-revoked.js b/js/src/tests/test262/built-ins/Array/isArray/proxy-revoked.js new file mode 100644 index 0000000000..5808591738 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/proxy-revoked.js @@ -0,0 +1,30 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-array.isarray +es6id: 22.1.2.2 +description: Revoked proxy value produces a TypeError +info: | + 1. Return IsArray(arg). + + 7.2.2 IsArray + + [...] + 3. If argument is a Proxy exotic object, then + a. If the value of the [[ProxyHandler]] internal slot of argument is null, + throw a TypeError exception. + b. Let target be the value of the [[ProxyTarget]] internal slot of + argument. + c. Return ? IsArray(target). +features: [Proxy] +---*/ + +var handle = Proxy.revocable([], {}); + +handle.revoke(); + +assert.throws(TypeError, function() { + Array.isArray(handle.proxy); +}, 'Array.isArray(handle.proxy) throws a TypeError exception'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/proxy.js b/js/src/tests/test262/built-ins/Array/isArray/proxy.js new file mode 100644 index 0000000000..fd369e07d1 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/proxy.js @@ -0,0 +1,32 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-array.isarray +es6id: 22.1.2.2 +description: Proxy of an array is treated as an array +info: | + 1. Return IsArray(arg). + + 7.2.2 IsArray + + [...] + 3. If argument is a Proxy exotic object, then + a. If the value of the [[ProxyHandler]] internal slot of argument is null, + throw a TypeError exception. + b. Let target be the value of the [[ProxyTarget]] internal slot of + argument. + c. Return ? IsArray(target). +features: [Proxy] +---*/ + +var objectProxy = new Proxy({}, {}); +var arrayProxy = new Proxy([], {}); +var arrayProxyProxy = new Proxy(arrayProxy, {}); + +assert.sameValue(Array.isArray(objectProxy), false, 'Array.isArray(new Proxy({}, {})) must return false'); +assert.sameValue(Array.isArray(arrayProxy), true, 'Array.isArray(new Proxy([], {})) must return true'); +assert.sameValue( + Array.isArray(arrayProxyProxy), true, 'Array.isArray(new Proxy(arrayProxy, {})) must return true' +); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Array/isArray/shell.js b/js/src/tests/test262/built-ins/Array/isArray/shell.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/shell.js |