diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/built-ins/Array/isArray | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/Array/isArray')
31 files changed, 479 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..3eabfa3b4e --- /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", 'typeof(f)'); + +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..40b5a6d63a --- /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, 'Array.isArray.length'); + +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..cb98535abe --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-3.js @@ -0,0 +1,15 @@ +// 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 +---*/ + +var a = []; +var b = Array.isArray(a); + +assert.sameValue(b, true, 'b'); + +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..c5ee865fc5 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-4.js @@ -0,0 +1,24 @@ +// 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 +---*/ + +var b_num = Array.isArray(42); +var b_undef = Array.isArray(undefined); +var b_bool = Array.isArray(true); +var b_str = Array.isArray("abc"); +var b_obj = Array.isArray({}); +var b_null = Array.isArray(null); + + +assert.sameValue(b_num, false, 'b_num'); +assert.sameValue(b_undef, false, 'b_undef'); +assert.sameValue(b_bool, false, 'b_bool'); +assert.sameValue(b_str, false, 'b_str'); +assert.sameValue(b_obj, false, 'b_obj'); +assert.sameValue(b_null, false, 'b_null'); + +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..247161bbeb --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-5.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 +es5id: 15.4.3.2-0-5 +description: > + Array.isArray return true if its argument is an Array + (Array.prototype) +---*/ + +var b = Array.isArray(Array.prototype); + +assert.sameValue(b, true, 'b'); + +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..eb2008a3df --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-6.js @@ -0,0 +1,15 @@ +// 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()) +---*/ + +var a = new Array(10); +var b = Array.isArray(a); + +assert.sameValue(b, true, 'b'); + +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..8c9f59791b --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/15.4.3.2-0-7.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 +es5id: 15.4.3.2-0-7 +description: Array.isArray returns false if its argument is not an Array +---*/ + +var o = new Object(); +o[12] = 13; +var b = Array.isArray(o); + +assert.sameValue(b, false, 'b'); + +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..66729153f0 --- /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)'); + +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..93ae80e68e --- /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())'); + +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..bc6cd27fc2 --- /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)'); + +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..7915a82f7f --- /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())'); + +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..ed34801cd2 --- /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(arg)'); + +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..270908205d --- /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)'); + +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..120c004ed0 --- /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))'); + +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..e6e6c15690 --- /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)'); + +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..92e5d08284 --- /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))'); + +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..5320c172f8 --- /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")'); + +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..b8c7a67767 --- /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\\!"))'); + +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..3b63b74e02 --- /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 () { })'); + +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..35294773e7 --- /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)'); + +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..3edd365ddd --- /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())'); + +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..6d05b9dff9 --- /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(child)'); + +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..3ffc745335 --- /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(child)'); + +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..d88d536b98 --- /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 })'); + +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..70e5c8fbb9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Array/isArray/descriptor.js @@ -0,0 +1,15 @@ +// 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..8e290b8835 --- /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"); + +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..e137915971 --- /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 TypeError'); + + +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..05d67890f1 --- /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); +}); + +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..c5dcd63633 --- /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); +assert.sameValue(Array.isArray(arrayProxy), true, 'proxy for array'); +assert.sameValue( + Array.isArray(arrayProxyProxy), true, 'proxy for proxy for array' +); + +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 |