Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic tests for WeakRef and FinalizationGroup #2192

Merged
merged 11 commits into from Jun 21, 2019
Next

Basic tests for weakref and finalizationgroup

  • Loading branch information...
leobalter committed Jun 3, 2019
commit 6e597f4298afd081e38d19871d9ca2fd723791b8
@@ -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
@@ -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.
---*/
This conversation was marked as resolved by rwaldron

This comment has been minimized.

Copy link
@rwaldron

rwaldron Jun 11, 2019

Contributor

Missing features: [FinalizationGroup]


assert.sameValue(
typeof FinalizationGroup, 'function',
'typeof FinalizationGroup is "function"'
);
@@ -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
});
@@ -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
});
@@ -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
});
@@ -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`'
);
@@ -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
});
@@ -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
});
@@ -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
});
@@ -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);
@@ -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"'
);
@@ -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
});
@@ -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
});
@@ -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
});
@@ -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`'
);
@@ -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
});
@@ -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
});
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.