Add tests for the Reflect object

This commit is contained in:
Leonardo Balter 2015-07-28 12:48:18 -04:00
parent a2554d909b
commit ff961826da
3 changed files with 59 additions and 0 deletions

View File

@ -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
description: >
The Reflect object is an ordinary object.
info: >
26.1 The Reflect Object
The Reflect object is the %Reflect% intrinsic object and the initial value of
the Reflect property of the global object. The Reflect object is an ordinary
object.
The Reflect object is not a function object. It does not have a [[Construct]]
internal method; it is not possible to use the Reflect object as a constructor
with the new operator. The Reflect object also does not have a [[Call]]
internal method; it is not possible to invoke the Reflect object as a
function.
---*/
assert.sameValue(typeof Reflect, 'object', '`typeof Reflect` is `"object"`');
// Reflect is not callable
assert.throws(TypeError, function() {
Reflect();
});
// Reflect doesn't have a constructor
assert.throws(TypeError, function() {
new Reflect();
});

View File

@ -0,0 +1,14 @@
// 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
description: >
The value of the [[Prototype]] internal slot of the Reflect object
is the intrinsic object %ObjectPrototype% (19.1.3).
---*/
assert.sameValue(
Object.getPrototypeOf(Reflect),
Object.prototype,
'`Object.getPrototypeOf(Reflect)` returns `Object.prototype`'
);

View File

@ -0,0 +1,14 @@
// 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
description: >
Reflect is configurable, writable and not enumerable.
info: >
17 ECMAScript Standard Built-in Objects
includes: [propertyHelper.js]
---*/
verifyNotEnumerable(this, 'Reflect');
verifyWritable(this, 'Reflect');
verifyConfigurable(this, 'Reflect');