Adds .name property descriptor tests for explicit resource management

These are all the name.js tests from @rbuckton's PR #3866 to make reviewing easier.
This commit is contained in:
Ron Buckton 2024-07-29 20:55:53 +02:00 committed by Philip Chimento
parent 8996664a42
commit 59657217f1
18 changed files with 551 additions and 0 deletions

View File

@ -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
});

View File

@ -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
});

View File

@ -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
});

View File

@ -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.disposeAsync
description: AsyncDisposableStack.prototype.disposeAsync.name property descriptor
info: |
AsyncDisposableStack.prototype.disposeAsync.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.disposeAsync, 'name', {
value: 'disposeAsync',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,28 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-asyncdisposablestack.prototype.disposed
description: >
AsyncDisposableStack.prototype.disposed.name value and descriptor.
info: |
get AsyncDisposableStack.prototype.size
17 ECMAScript Standard Built-in Objects
Functions that are specified as get or set accessor functions of built-in
properties have "get " or "set " prepended to the property name string.
includes: [propertyHelper.js]
features: [explicit-resource-management]
---*/
var descriptor = Object.getOwnPropertyDescriptor(AsyncDisposableStack.prototype, 'disposed');
assert.sameValue(descriptor.get.name,
'get disposed',
'The value of `descriptor.get.name` is `get disposed`'
);
verifyNotEnumerable(descriptor.get, 'name');
verifyNotWritable(descriptor.get, 'name');
verifyConfigurable(descriptor.get, 'name');

View File

@ -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.move
description: AsyncDisposableStack.prototype.move.name property descriptor
info: |
AsyncDisposableStack.prototype.move.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.move, 'name', {
value: 'move',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -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.use
description: AsyncDisposableStack.prototype.use.name property descriptor
info: |
AsyncDisposableStack.prototype.use.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.use, 'name', {
value: 'use',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%asynciteratorprototype%-@@asyncDispose
description: Descriptor for `name` property
info: |
The value of the name property of this function is "[Symbol.asyncDispose]".
ES6 Section 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.
[...]
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
features: [explicit-resource-management]
includes: [propertyHelper.js]
---*/
async function* generator() {}
const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(generator.prototype))
verifyProperty(AsyncIteratorPrototype[Symbol.asyncDispose], 'name', {
value: '[Symbol.asyncDispose]',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -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-disposablestack
description: DisposableStack.name property descriptor
info: |
DisposableStack ( )
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(DisposableStack, 'name', {
value: 'DisposableStack',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -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-disposablestack.prototype.adopt
description: DisposableStack.prototype.adopt.name property descriptor
info: |
DisposableStack.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(DisposableStack.prototype.adopt, 'name', {
value: 'adopt',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -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-disposablestack.prototype.defer
description: DisposableStack.prototype.defer.name property descriptor
info: |
DisposableStack.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(DisposableStack.prototype.defer, 'name', {
value: 'defer',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -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-disposablestack.prototype.dispose
description: DisposableStack.prototype.dispose.name property descriptor
info: |
DisposableStack.prototype.dispose.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(DisposableStack.prototype.dispose, 'name', {
value: 'dispose',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,28 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-get-disposablestack.prototype.disposed
description: >
DisposableStack.prototype.disposed.name value and descriptor.
info: |
get DisposableStack.prototype.size
17 ECMAScript Standard Built-in Objects
Functions that are specified as get or set accessor functions of built-in
properties have "get " or "set " prepended to the property name string.
includes: [propertyHelper.js]
features: [explicit-resource-management]
---*/
var descriptor = Object.getOwnPropertyDescriptor(DisposableStack.prototype, 'disposed');
assert.sameValue(descriptor.get.name,
'get disposed',
'The value of `descriptor.get.name` is `get disposed`'
);
verifyNotEnumerable(descriptor.get, 'name');
verifyNotWritable(descriptor.get, 'name');
verifyConfigurable(descriptor.get, 'name');

View File

@ -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-disposablestack.prototype.move
description: DisposableStack.prototype.move.name property descriptor
info: |
DisposableStack.prototype.move.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(DisposableStack.prototype.move, 'name', {
value: 'move',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -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-disposablestack.prototype.use
description: DisposableStack.prototype.use.name property descriptor
info: |
DisposableStack.prototype.use.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(DisposableStack.prototype.use, 'name', {
value: 'use',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-%iteratorprototype%-@@dispose
description: Descriptor for `name` property
info: |
The value of the name property of this function is "[Symbol.dispose]".
ES6 Section 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.
[...]
Unless otherwise specified, the name property of a built-in Function
object, if it exists, has the attributes { [[Writable]]: false,
[[Enumerable]]: false, [[Configurable]]: true }.
features: [explicit-resource-management]
includes: [propertyHelper.js]
---*/
const IteratorPrototype = Object.getPrototypeOf(
Object.getPrototypeOf([][Symbol.iterator]())
);
verifyProperty(IteratorPrototype[Symbol.dispose], 'name', {
value: '[Symbol.dispose]',
writable: false,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,33 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-properties-of-the-suppressederror-constructor
description: SuppressedError.name property descriptor
info: |
Properties of the SuppressedError Constructor
- has a name property whose value is the String value "SuppressedError".
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(SuppressedError, 'name', {
value: 'SuppressedError',
writable: false,
enumerable: false,
configurable: true
});

View File

@ -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-aggregate-error.prototype.name
description: >
The `SuppressedError.prototype.name` property descriptor.
info: |
The initial value of SuppressedError.prototype.name is "SuppressedError".
17 ECMAScript Standard Built-in Objects:
Every other data property described (...) has the attributes { [[Writable]]: true,
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
includes: [propertyHelper.js]
features: [explicit-resource-management]
---*/
verifyProperty(SuppressedError.prototype, 'name', {
value: 'SuppressedError',
enumerable: false,
writable: true,
configurable: true
});