From ff961826daef5ce1f2fabbdbbd0cd89744a2b5f9 Mon Sep 17 00:00:00 2001 From: Leonardo Balter Date: Tue, 28 Jul 2015 12:48:18 -0400 Subject: [PATCH] Add tests for the Reflect object --- test/built-ins/Reflect/Reflect.js | 31 ++++++++++++++++++++++ test/built-ins/Reflect/object-prototype.js | 14 ++++++++++ test/built-ins/Reflect/properties.js | 14 ++++++++++ 3 files changed, 59 insertions(+) create mode 100644 test/built-ins/Reflect/Reflect.js create mode 100644 test/built-ins/Reflect/object-prototype.js create mode 100644 test/built-ins/Reflect/properties.js diff --git a/test/built-ins/Reflect/Reflect.js b/test/built-ins/Reflect/Reflect.js new file mode 100644 index 0000000000..e219c8c0d7 --- /dev/null +++ b/test/built-ins/Reflect/Reflect.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 +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(); +}); diff --git a/test/built-ins/Reflect/object-prototype.js b/test/built-ins/Reflect/object-prototype.js new file mode 100644 index 0000000000..845498151b --- /dev/null +++ b/test/built-ins/Reflect/object-prototype.js @@ -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`' +); diff --git a/test/built-ins/Reflect/properties.js b/test/built-ins/Reflect/properties.js new file mode 100644 index 0000000000..5873c77179 --- /dev/null +++ b/test/built-ins/Reflect/properties.js @@ -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');