Basic tests for weakref and finalizationgroup

This commit is contained in:
Leo Balter 2019-06-03 13:49:03 -04:00 committed by Rick Waldron
parent b223ac4e1f
commit 969d4e68b4
19 changed files with 395 additions and 0 deletions

View File

@ -128,6 +128,11 @@ export-star-as-namespace-from-module
# https://github.com/tc39/proposal-import-meta
import.meta
# WeakRef
# https://github.com/tc39/proposal-weakref
WeakRef
FinalizationGroup
## Standard language features
#
# Language features that have been included in a published version of the

View File

@ -0,0 +1,14 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-finalization-group-constructor
description: >
The FinalizationGroup constructor is the %FinalizationGroup% intrinsic object and the initial
value of the FinalizationGroup property of the global object.
---*/
assert.sameValue(
typeof FinalizationGroup, 'function',
'typeof FinalizationGroup is "function"'
);

View File

@ -0,0 +1,32 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-finalization-group-target
description: FinalizationGroup.length property descriptor
info: |
FinalizationGroup ( cleanupCallback )
17 ECMAScript Standard Built-in Objects
Every built-in function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this
value is equal to the largest number of named arguments shown in the
subclause headings for the function description. Optional parameters
(which are indicated with brackets: [ ]) or rest parameters (which
are shown using the form «...name») are not included in the default
argument 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: [FinalizationGroup]
---*/
verifyProperty(FinalizationGroup, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-finalization-group-target
description: FinalizationGroup.name property descriptor
info: |
FinalizationGroup ( value )
17 ECMAScript Standard Built-in Objects
Every built-in function object, including constructors, that is not
identified as an anonymous function 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. For functions that
are specified as properties of objects, the name value is the
property name string used to access the function. [...]
Unless otherwise specified, the name property of a built-in function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [FinalizationGroup]
---*/
verifyProperty(FinalizationGroup, "name", {
value: "FinalizationGroup",
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,22 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-finalization-group-constructor
description: >
Property descriptor of FinalizationGroup
info: |
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [FinalizationGroup]
---*/
verifyProperty(this, "FinalizationGroup", {
enumerable: false,
writable: true,
configurable: true
});

View File

@ -0,0 +1,18 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-finalization-group-constructor
description: >
The prototype of FinalizationGroup is Object.prototype
info: |
The value of the [[Prototype]] internal slot of the FinalizationGroup object is the
intrinsic object %FunctionPrototype%.
features: [FinalizationGroup]
---*/
assert.sameValue(
Object.getPrototypeOf(FinalizationGroup),
Function.prototype,
'Object.getPrototypeOf(FinalizationGroup) returns the value of `Function.prototype`'
);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-finalization-group-@@tostringtag
description: >
`Symbol.toStringTag` property descriptor
info: |
The initial value of the @@toStringTag property is the String value
"FinalizationGroup".
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [FinalizationGroup, Symbol, Symbol.toStringTag]
---*/
verifyProperty(FinalizationGroup.prototype, Symbol.toStringTag, {
value: "FinalizationGroup",
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,23 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-finalization-group.prototype.constructor
description: FinalizationGroup.prototype.constructor property descriptor
info: |
FinalizationGroup.prototype.constructor
The initial value of FinalizationGroup.prototype.constructor is the intrinsic
object %FinalizationGroup%.
17 ECMAScript Standard Built-in Objects
includes: [propertyHelper.js]
features: [FinalizationGroup]
---*/
verifyProperty(FinalizationGroup.prototype, "constructor", {
value: FinalizationGroup,
writable: true,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,18 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The property descriptor FinalizationGroup.prototype
esid: sec-finalization-group.prototype
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: false }.
features: [FinalizationGroup]
includes: [propertyHelper.js]
---*/
verifyProperty(FinalizationGroup, "prototype", {
writable: false,
enumerable: false,
configurable: false
});

View File

@ -0,0 +1,14 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The prototype of FinalizationGroup.prototype is Object.prototype
esid: sec-properties-of-the-finalization-group-prototype-object
info: |
The value of the [[Prototype]] internal slot of the FinalizationGroup prototype object
is the intrinsic object %ObjectPrototype%.
features: [FinalizationGroup]
---*/
var proto = Object.getPrototypeOf(FinalizationGroup.prototype);
assert.sameValue(proto, Object.prototype);

View File

@ -0,0 +1,14 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-weak-ref-constructor
description: >
The WeakRef constructor is the %WeakRef% intrinsic object and the initial
value of the WeakRef property of the global object.
---*/
assert.sameValue(
typeof WeakRef, 'function',
'typeof WeakRef is "function"'
);

View File

@ -0,0 +1,32 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-weak-ref-target
description: WeakRef.length property descriptor
info: |
WeakRef ( target )
17 ECMAScript Standard Built-in Objects
Every built-in function object, including constructors, has a length
property whose value is an integer. Unless otherwise specified, this
value is equal to the largest number of named arguments shown in the
subclause headings for the function description. Optional parameters
(which are indicated with brackets: [ ]) or rest parameters (which
are shown using the form «...name») are not included in the default
argument 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: [WeakRef]
---*/
verifyProperty(WeakRef, "length", {
value: 1,
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,31 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-weak-ref-target
description: WeakRef.name property descriptor
info: |
WeakRef ( value )
17 ECMAScript Standard Built-in Objects
Every built-in function object, including constructors, that is not
identified as an anonymous function 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. For functions that
are specified as properties of objects, the name value is the
property name string used to access the function. [...]
Unless otherwise specified, the name property of a built-in function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [WeakRef]
---*/
verifyProperty(WeakRef, "name", {
value: "WeakRef",
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,22 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-weak-ref-constructor
description: >
Property descriptor of WeakRef
info: |
17 ECMAScript Standard Built-in Objects:
Every other data property described in clauses 18 through 26 and in Annex B.2
has the attributes { [[Writable]]: true, [[Enumerable]]: false,
[[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [WeakRef]
---*/
verifyProperty(this, "WeakRef", {
enumerable: false,
writable: true,
configurable: true
});

View File

@ -0,0 +1,18 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-weak-ref-constructor
description: >
The prototype of WeakRef is Object.prototype
info: |
The value of the [[Prototype]] internal slot of the WeakRef object is the
intrinsic object %FunctionPrototype%.
features: [WeakRef]
---*/
assert.sameValue(
Object.getPrototypeOf(WeakRef),
Function.prototype,
'Object.getPrototypeOf(WeakRef) returns the value of `Function.prototype`'
);

View File

@ -0,0 +1,23 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-weak-ref-@@tostringtag
description: >
`Symbol.toStringTag` property descriptor
info: |
The initial value of the @@toStringTag property is the String value
"WeakRef".
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: true }.
includes: [propertyHelper.js]
features: [WeakRef, Symbol, Symbol.toStringTag]
---*/
verifyProperty(WeakRef.prototype, Symbol.toStringTag, {
value: "WeakRef",
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,23 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-weak-ref.prototype.constructor
description: WeakRef.prototype.constructor property descriptor
info: |
WeakRef.prototype.constructor
The initial value of WeakRef.prototype.constructor is the intrinsic
object %WeakRef%.
17 ECMAScript Standard Built-in Objects
includes: [propertyHelper.js]
features: [WeakRef]
---*/
verifyProperty(WeakRef.prototype, "constructor", {
value: WeakRef,
writable: true,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,18 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The property descriptor WeakRef.prototype
esid: sec-weak-ref.prototype
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: false }.
features: [WeakRef]
includes: [propertyHelper.js]
---*/
verifyProperty(WeakRef, "prototype", {
writable: false,
enumerable: false,
configurable: false
});

View File

@ -0,0 +1,14 @@
// Copyright (C) 2019 Leo Balter. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The prototype of WeakRef.prototype is Object.prototype
esid: sec-properties-of-the-weak-ref-prototype-object
info: |
The value of the [[Prototype]] internal slot of the WeakRef prototype object
is the intrinsic object %ObjectPrototype%.
features: [WeakRef]
---*/
var proto = Object.getPrototypeOf(WeakRef.prototype);
assert.sameValue(proto, Object.prototype);