Skip to content
23 changes: 23 additions & 0 deletions test/built-ins/AsyncDisposableStack/is-a-constructor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (C) 2023 Ron Buckton. 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 AsyncDisposableStack constructor implements [[Construct]]
info: |
IsConstructor ( argument )

The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
It determines if argument is a function object with a [[Construct]] internal method.
It performs the following steps when called:

If Type(argument) is not Object, return false.
If argument has a [[Construct]] internal method, return true.
Return false.
includes: [isConstructor.js]
features: [explicit-resource-management, Reflect.construct]
---*/

assert.sameValue(isConstructor(AsyncDisposableStack), true, 'isConstructor(AsyncDisposableStack) must return true');
new AsyncDisposableStack();
32 changes: 32 additions & 0 deletions test/built-ins/AsyncDisposableStack/length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack
description: AsyncDisposableStack.length property descriptor
info: |
AsyncDisposableStack ( )

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: [explicit-resource-management]
---*/

verifyProperty(AsyncDisposableStack, 'length', {
value: 0,
writable: false,
enumerable: false,
configurable: true
});
31 changes: 31 additions & 0 deletions test/built-ins/AsyncDisposableStack/name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack
description: AsyncDisposableStack.name property descriptor
info: |
AsyncDisposableStack ( )

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: [explicit-resource-management]
---*/

verifyProperty(AsyncDisposableStack, 'name', {
value: 'AsyncDisposableStack',
writable: false,
enumerable: false,
configurable: true
});
22 changes: 22 additions & 0 deletions test/built-ins/AsyncDisposableStack/prop-desc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack-constructor
description: >
Property descriptor of AsyncDisposableStack
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: [explicit-resource-management]
---*/

verifyProperty(this, 'AsyncDisposableStack', {
enumerable: false,
writable: true,
configurable: true
});
32 changes: 32 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/adopt/length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.adopt
description: AsyncDisposableStack.prototype.adopt.length property descriptor
info: |
AsyncDisposableStack.prototype.adopt ( value, onDisposeAsync )

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: [explicit-resource-management]
---*/

verifyProperty(AsyncDisposableStack.prototype.adopt, 'length', {
value: 2,
writable: false,
enumerable: false,
configurable: true
});
31 changes: 31 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/adopt/name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.adopt
description: AsyncDisposableStack.prototype.adopt.name property descriptor
info: |
AsyncDisposableStack.prototype.adopt.name value and property descriptor

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: [explicit-resource-management]
---*/

verifyProperty(AsyncDisposableStack.prototype.adopt, 'name', {
value: 'adopt',
writable: false,
enumerable: false,
configurable: true
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.adopt
description: >
AsyncDisposableStack.prototype.adopt does not implement [[Construct]], is not new-able
info: |
ECMAScript Function Objects

Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified in
the description of a particular function.

sec-evaluatenew

...
7. If IsConstructor(constructor) is false, throw a TypeError exception.
...
includes: [isConstructor.js]
features: [Reflect.construct, explicit-resource-management, arrow-function]
---*/

assert.sameValue(
isConstructor(AsyncDisposableStack.prototype.adopt),
false,
'isConstructor(AsyncDisposableStack.prototype.adopt) must return false'
);

assert.throws(TypeError, () => {
let stack = new AsyncDisposableStack({}); new stack.adopt();
}, '`let stack = new AsyncDisposableStack({}); new stack.adopt()` throws TypeError');
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.adopt
description: >
Property descriptor of AsyncDisposableStack.prototype.adopt
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: [explicit-resource-management]
---*/

assert.sameValue(typeof AsyncDisposableStack.prototype.adopt, 'function');

verifyProperty(AsyncDisposableStack.prototype, 'adopt', {
enumerable: false,
writable: true,
configurable: true
});
32 changes: 32 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/defer/length.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.defer
description: AsyncDisposableStack.prototype.defer.length property descriptor
info: |
AsyncDisposableStack.prototype.defer ( onDisposeAsync )

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: [explicit-resource-management]
---*/

verifyProperty(AsyncDisposableStack.prototype.defer, 'length', {
value: 1,
writable: false,
enumerable: false,
configurable: true
});
31 changes: 31 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/defer/name.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.defer
description: AsyncDisposableStack.prototype.defer.name property descriptor
info: |
AsyncDisposableStack.prototype.defer.name value and property descriptor

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: [explicit-resource-management]
---*/

verifyProperty(AsyncDisposableStack.prototype.defer, 'name', {
value: 'defer',
writable: false,
enumerable: false,
configurable: true
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.defer
description: >
AsyncDisposableStack.prototype.defer does not implement [[Construct]], is not new-able
info: |
ECMAScript Function Objects

Built-in function objects that are not identified as constructors do not
implement the [[Construct]] internal method unless otherwise specified in
the description of a particular function.

sec-evaluatenew

...
7. If IsConstructor(constructor) is false, throw a TypeError exception.
...
includes: [isConstructor.js]
features: [Reflect.construct, explicit-resource-management, arrow-function]
---*/

assert.sameValue(
isConstructor(AsyncDisposableStack.prototype.defer),
false,
'isConstructor(AsyncDisposableStack.prototype.defer) must return false'
);

assert.throws(TypeError, () => {
let stack = new AsyncDisposableStack({}); new stack.defer();
}, '`let stack = new AsyncDisposableStack({}); new stack.defer()` throws TypeError');
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.defer
description: >
Property descriptor of AsyncDisposableStack.prototype.defer
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: [explicit-resource-management]
---*/

assert.sameValue(typeof AsyncDisposableStack.prototype.defer, 'function');

verifyProperty(AsyncDisposableStack.prototype, 'defer', {
enumerable: false,
writable: true,
configurable: true
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-asyncdisposablestack.prototype.disposeAsync
description: AsyncDisposableStack.prototype.disposeAsync.length property descriptor
info: |
AsyncDisposableStack.prototype.disposeAsync ( )

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: [explicit-resource-management]
---*/

verifyProperty(AsyncDisposableStack.prototype.disposeAsync, 'length', {
value: 0,
writable: false,
enumerable: false,
configurable: true
});
Loading