diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Reflect/isExtensible')
10 files changed, 212 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/browser.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/browser.js new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/browser.js diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/isExtensible.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/isExtensible.js new file mode 100644 index 0000000000..1e5587696b --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/isExtensible.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.10 +description: > + Reflect.isExtensible is configurable, writable and not enumerable. +info: | + 26.1.10 Reflect.isExtensible (target) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +features: [Reflect] +---*/ + +verifyNotEnumerable(Reflect, 'isExtensible'); +verifyWritable(Reflect, 'isExtensible'); +verifyConfigurable(Reflect, 'isExtensible'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/length.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/length.js new file mode 100644 index 0000000000..31dd4d802a --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/length.js @@ -0,0 +1,20 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.10 +description: > + Reflect.isExtensible.length value and property descriptor +includes: [propertyHelper.js] +features: [Reflect] +---*/ + +assert.sameValue( + Reflect.isExtensible.length, 1, + 'The value of `Reflect.isExtensible.length` is `1`' +); + +verifyNotEnumerable(Reflect.isExtensible, 'length'); +verifyNotWritable(Reflect.isExtensible, 'length'); +verifyConfigurable(Reflect.isExtensible, 'length'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/name.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/name.js new file mode 100644 index 0000000000..04ba531667 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/name.js @@ -0,0 +1,25 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.10 +description: > + Reflect.isExtensible.name value and property descriptor +info: | + 26.1.10 Reflect.isExtensible (target) + + 17 ECMAScript Standard Built-in Objects + +includes: [propertyHelper.js] +features: [Reflect] +---*/ + +assert.sameValue( + Reflect.isExtensible.name, 'isExtensible', + 'The value of `Reflect.isExtensible.name` is `"isExtensible"`' +); + +verifyNotEnumerable(Reflect.isExtensible, 'name'); +verifyNotWritable(Reflect.isExtensible, 'name'); +verifyConfigurable(Reflect.isExtensible, 'name'); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/not-a-constructor.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/not-a-constructor.js new file mode 100644 index 0000000000..e45a445b84 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/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: > + Reflect.isExtensible 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, Reflect, arrow-function] +---*/ + +assert.sameValue(isConstructor(Reflect.isExtensible), false, 'isConstructor(Reflect.isExtensible) must return false'); + +assert.throws(TypeError, () => { + new Reflect.isExtensible({}); +}, '`new Reflect.isExtensible({})` throws TypeError'); + + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/return-abrupt-from-result.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/return-abrupt-from-result.js new file mode 100644 index 0000000000..0928e57d07 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/return-abrupt-from-result.js @@ -0,0 +1,26 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.10 +description: > + Return abrupt result. +info: | + 26.1.10 Reflect.isExtensible (target) + + ... + 2. Return target.[[IsExtensible]](). +features: [Proxy, Reflect] +---*/ + +var o1 = {}; +var p = new Proxy(o1, { + isExtensible: function() { + throw new Test262Error(); + } +}); + +assert.throws(Test262Error, function() { + Reflect.isExtensible(p); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/return-boolean.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/return-boolean.js new file mode 100644 index 0000000000..fbf4df41c9 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/return-boolean.js @@ -0,0 +1,21 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.10 +description: > + Returns the boolean result. +info: | + 26.1.10 Reflect.isExtensible (target) + + ... + 2. Return target.[[IsExtensible]](). +features: [Reflect] +---*/ + +var o = {}; +assert.sameValue(Reflect.isExtensible(o), true); + +Object.preventExtensions(o); +assert.sameValue(Reflect.isExtensible(o), false); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/shell.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/shell.js new file mode 100644 index 0000000000..54371b7789 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/shell.js @@ -0,0 +1,19 @@ +// GENERATED, DO NOT EDIT +// file: isConstructor.js +// Copyright (C) 2017 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: | + Test if a given function is a constructor function. +defines: [isConstructor] +---*/ + +function isConstructor(f) { + try { + Reflect.construct(function(){}, [], f); + } catch (e) { + return false; + } + return true; +} diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/target-is-not-object-throws.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/target-is-not-object-throws.js new file mode 100644 index 0000000000..dfe224d4ef --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/target-is-not-object-throws.js @@ -0,0 +1,31 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.10 +description: > + Throws a TypeError if target is not an Object. +info: | + 26.1.10 Reflect.isExtensible (target) + + 1. If Type(target) is not Object, throw a TypeError exception. + ... +features: [Reflect] +---*/ + +assert.throws(TypeError, function() { + Reflect.isExtensible(1); +}); + +assert.throws(TypeError, function() { + Reflect.isExtensible(null); +}); + +assert.throws(TypeError, function() { + Reflect.isExtensible(undefined); +}); + +assert.throws(TypeError, function() { + Reflect.isExtensible(''); +}); + +reportCompare(0, 0); diff --git a/js/src/tests/test262/built-ins/Reflect/isExtensible/target-is-symbol-throws.js b/js/src/tests/test262/built-ins/Reflect/isExtensible/target-is-symbol-throws.js new file mode 100644 index 0000000000..4fdb837c23 --- /dev/null +++ b/js/src/tests/test262/built-ins/Reflect/isExtensible/target-is-symbol-throws.js @@ -0,0 +1,19 @@ +// Copyright (C) 2015 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +es6id: 26.1.10 +description: > + Throws a TypeError if target is a Symbol +info: | + 26.1.10 Reflect.isExtensible (target) + + 1. If Type(target) is not Object, throw a TypeError exception. + ... +features: [Reflect, Symbol] +---*/ + +assert.throws(TypeError, function() { + Reflect.isExtensible(Symbol(1)); +}); + +reportCompare(0, 0); |