Add tests for Reflect.isExtensible

This commit is contained in:
Leonardo Balter 2015-07-29 17:36:07 -04:00
parent 257bd7b48e
commit a66ae7cbce
7 changed files with 143 additions and 0 deletions

View File

@ -0,0 +1,17 @@
// 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]
---*/
verifyNotEnumerable(Reflect, 'isExtensible');
verifyWritable(Reflect, 'isExtensible');
verifyConfigurable(Reflect, 'isExtensible');

View File

@ -0,0 +1,17 @@
// 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]
---*/
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');

View File

@ -0,0 +1,22 @@
// 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]
---*/
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');

View File

@ -0,0 +1,24 @@
// 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]
---*/
var o1 = {};
var p = new Proxy(o1, {
isExtensible: function() {
throw new Test262Error();
}
});
assert.throws(Test262Error, function() {
Reflect.isExtensible(p);
});

View File

@ -0,0 +1,18 @@
// 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]]().
---*/
var o = {};
assert.sameValue(Reflect.isExtensible(o), true);
Object.preventExtensions(o);
assert.sameValue(Reflect.isExtensible(o), false);

View File

@ -0,0 +1,28 @@
// 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.
...
---*/
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('');
});

View File

@ -0,0 +1,17 @@
// 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: [Symbol]
---*/
assert.throws(TypeError, function() {
Reflect.isExtensible(Symbol(1));
});