mirror of https://github.com/tc39/test262.git
tests: Realm.prototype.evaluate, Realm.prototype.importValue
This commit is contained in:
parent
f5fd1af49f
commit
935d08814e
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm-constructor
|
||||
description: >
|
||||
Realm is a constructor and has [[Construct]] internal method.
|
||||
includes: [isConstructor.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
assert.sameValue(
|
||||
typeof Realm,
|
||||
'function',
|
||||
'This test must fail if Realm is not a function'
|
||||
);
|
||||
|
||||
assert(isConstructor(Realm));
|
||||
assert.sameValue(Object.getPrototypeOf(Realm), Function.prototype);
|
||||
new Realm();
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm-constructor
|
||||
description: >
|
||||
The Realm constructor is the initial value of the "Realm" property of the global object.
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(this, "Realm");
|
||||
verifyWritable(this, "Realm");
|
||||
verifyConfigurable(this, "Realm");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm-constructor
|
||||
description: >
|
||||
new Realm() returns a realm instance
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
assert.sameValue(
|
||||
typeof Realm,
|
||||
'function',
|
||||
'This test must fail if Realm is not a function'
|
||||
);
|
||||
|
||||
assert(new Realm() instanceof Realm);
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2021 Rick waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm-constructor
|
||||
description: >
|
||||
The value of Realm.length is 0
|
||||
info: |
|
||||
Realm ( )
|
||||
|
||||
Every built-in function object, including constructors, has a "length" property
|
||||
whose value is a non-negative integral Number. Unless otherwise specified, this value
|
||||
is equal to the number of required parameters shown in the subclause heading for the
|
||||
function description. Optional parameters and rest parameters are not included in
|
||||
the parameter count.
|
||||
|
||||
Unless otherwise specified, the "length" property of a built-in function object has
|
||||
the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Realm.length, 0, "The value of `Realm.length` is `0`");
|
||||
|
||||
verifyNotEnumerable(Realm, "length");
|
||||
verifyNotWritable(Realm, "length");
|
||||
verifyConfigurable(Realm, "length");
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2021 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: >
|
||||
The value of Realm.name is 'Realm'
|
||||
info: |
|
||||
Every built-in function object, including constructors, has a "name" property
|
||||
whose value is a String. Unless otherwise specified, this value is the name
|
||||
that is given to the function in this specification.
|
||||
|
||||
Unless otherwise specified, the "name" property of a built-in function
|
||||
object has the attributes
|
||||
{ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Realm.name, "Realm", "The value of `Realm.name` is `'Realm'`");
|
||||
|
||||
verifyNotEnumerable(Realm, "name");
|
||||
verifyNotWritable(Realm, "name");
|
||||
verifyConfigurable(Realm, "name");
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-properties-of-the-realm-constructor
|
||||
description: >
|
||||
The [[Prototype]] of Realm is Function.Prototype.
|
||||
info: |
|
||||
Unless otherwise specified every built-in function and every built-in constructor
|
||||
has the Function prototype object, which is the initial value of the expression
|
||||
Function.prototype, as the value of its [[Prototype]] internal slot.
|
||||
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Realm), Function.prototype);
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.evaluate
|
||||
description: >
|
||||
Realm.prototype.evaluate is an ECMAScript Standard built-in object function.
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(Realm.prototype, "evaluate");
|
||||
verifyWritable(Realm.prototype, "evaluate");
|
||||
verifyConfigurable(Realm.prototype, "evaluate");
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2021 Rick waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.evaluate
|
||||
description: >
|
||||
The value of Realm.prototype.evaluate.length is 1
|
||||
info: |
|
||||
Realm.prototype.evaluate ( sourceText )
|
||||
|
||||
Every built-in function object, including constructors, has a "length" property
|
||||
whose value is a non-negative integral Number. Unless otherwise specified, this value
|
||||
is equal to the number of required parameters shown in the subclause heading for the
|
||||
function description. Optional parameters and rest parameters are not included in
|
||||
the parameter count.
|
||||
|
||||
Unless otherwise specified, the "length" property of a built-in function object has
|
||||
the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Realm.prototype.evaluate.length, 1, "The value of `Realm.prototype.evaluate.length` is `1`");
|
||||
|
||||
verifyNotEnumerable(Realm.prototype.evaluate, "length");
|
||||
verifyNotWritable(Realm.prototype.evaluate, "length");
|
||||
verifyConfigurable(Realm.prototype.evaluate, "length");
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.evaluate
|
||||
description: >
|
||||
The value of Realm.prototype.evaluate.name is 'evaluate'
|
||||
info: |
|
||||
Every built-in function object, including constructors, has a "name" property
|
||||
whose value is a String. Unless otherwise specified, this value is the name
|
||||
that is given to the function in this specification.
|
||||
|
||||
Unless otherwise specified, the "name" property of a built-in function
|
||||
object has the attributes
|
||||
{ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Realm.prototype.evaluate.name, "evaluate", "The value of `Realm.prototype.evaluate.name` is `'evaluate'`");
|
||||
|
||||
verifyNotEnumerable(Realm.prototype.evaluate, "name");
|
||||
verifyNotWritable(Realm.prototype.evaluate, "name");
|
||||
verifyConfigurable(Realm.prototype.evaluate, "name");
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.evaluate
|
||||
description: >
|
||||
Realm.prototype.evaluate is not a constructor.
|
||||
includes: [isConstructor.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof Realm.prototype.evaluate,
|
||||
'function',
|
||||
'This test must fail if Realm.prototype.evaluate is not a function'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
isConstructor(Realm.prototype.evaluate),
|
||||
false,
|
||||
'isConstructor(Realm.prototype.evaluate) must return false'
|
||||
);
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Realm.prototype.evaluate("");
|
||||
}, '`let value = new Realm.prototype.evaluate("")` throws TypeError');
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.evaluate
|
||||
description: >
|
||||
The [[Prototype]] of Realm.prototype.evaluate is Function.Prototype.
|
||||
|
||||
Unless otherwise specified every built-in function and every built-in constructor
|
||||
has the Function prototype object, which is the initial value of the expression
|
||||
Function.prototype, as the value of its [[Prototype]] internal slot.
|
||||
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Realm.prototype.evaluate), Function.prototype);
|
|
@ -0,0 +1,13 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.importvalue
|
||||
description: >
|
||||
Realm.prototype.importValue is an ECMAScript Standard built-in object function.
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
verifyNotEnumerable(Realm.prototype, "importValue");
|
||||
verifyWritable(Realm.prototype, "importValue");
|
||||
verifyConfigurable(Realm.prototype, "importValue");
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2021 Rick waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.importvalue
|
||||
description: >
|
||||
The value of Realm.prototype.importValue.length is 2
|
||||
info: |
|
||||
Every built-in function object, including constructors, has a "length" property
|
||||
whose value is a non-negative integral Number. Unless otherwise specified, this value
|
||||
is equal to the number of required parameters shown in the subclause heading for the
|
||||
function description. Optional parameters and rest parameters are not included in
|
||||
the parameter count.
|
||||
|
||||
Unless otherwise specified, the "length" property of a built-in function object has
|
||||
the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Realm.prototype.importValue.length, 2, "The value of `Realm.prototype.importValue.length` is `2`");
|
||||
|
||||
verifyNotEnumerable(Realm.prototype.importValue, "length");
|
||||
verifyNotWritable(Realm.prototype.importValue, "length");
|
||||
verifyConfigurable(Realm.prototype.importValue, "length");
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.importValue
|
||||
description: >
|
||||
The value of Realm.prototype.importValue.name is 'importValue'
|
||||
info: |
|
||||
Realm.prototype.importValue
|
||||
|
||||
Every built-in function object, including constructors, has a "name" property
|
||||
whose value is a String. Unless otherwise specified, this value is the name
|
||||
that is given to the function in this specification.
|
||||
|
||||
Unless otherwise specified, the "name" property of a built-in function
|
||||
object has the attributes
|
||||
{ [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
|
||||
|
||||
includes: [propertyHelper.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Realm.prototype.importValue.name, "importValue", "The value of `Realm.prototype.importValue.name` is `'importValue'`");
|
||||
|
||||
verifyNotEnumerable(Realm.prototype.importValue, "name");
|
||||
verifyNotWritable(Realm.prototype.importValue, "name");
|
||||
verifyConfigurable(Realm.prototype.importValue, "name");
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.importvalue
|
||||
description: >
|
||||
Realm.prototype.importValue is not a constructor.
|
||||
includes: [isConstructor.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof Realm.prototype.importValue,
|
||||
'function',
|
||||
'This test must fail if Realm.prototype.importValue is not a function'
|
||||
);
|
||||
|
||||
assert.sameValue(
|
||||
isConstructor(Realm.prototype.importValue),
|
||||
false,
|
||||
'isConstructor(Realm.prototype.importValue) must return false'
|
||||
);
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Realm.prototype.importValue("");
|
||||
}, '`let value = new Realm.prototype.importValue("")` throws TypeError');
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-realm.prototype.importvalue
|
||||
description: >
|
||||
The [[Prototype]] of Realm.prototype.importValue is AsyncFunction.Prototype.
|
||||
info: |
|
||||
Unless otherwise specified every built-in function and every built-in constructor
|
||||
has the Function prototype object, which is the initial value of the expression
|
||||
Function.prototype, as the value of its [[Prototype]] internal slot.
|
||||
|
||||
includes: [hidden-constructors.js]
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Realm.prototype.importValue), AsyncFunction.prototype);
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-properties-of-the-realm-prototype-object
|
||||
description: >
|
||||
The [[Prototype]] of Realm.prototype is Object.Prototype.
|
||||
info: |
|
||||
Unless otherwise specified every built-in prototype object has the Object prototype
|
||||
object, which is the initial value of the expression Object.prototype, as the value
|
||||
of its [[Prototype]] internal slot, except the Object prototype object itself.
|
||||
|
||||
features: [callable-boundary-realms]
|
||||
---*/
|
||||
|
||||
assert.sameValue(Object.getPrototypeOf(Realm.prototype), Object.prototype);
|
Loading…
Reference in New Issue