Adds property descriptor tests for explicit resource management objects

These are all the prop-desc.js tests from @rbuckton's PR #3866 to make reviewing easier.
This commit is contained in:
Ron Buckton 2024-07-29 20:28:59 +02:00 committed by Philip Chimento
parent 3b89be9c5d
commit 3a615a0c0e
20 changed files with 450 additions and 0 deletions

View File

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

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

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

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-asyncdisposablestack.prototype.disposeAsync
description: >
Property descriptor of AsyncDisposableStack.prototype.disposeAsync
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.disposeAsync, 'function');
verifyProperty(AsyncDisposableStack.prototype, 'disposeAsync', {
enumerable: false,
writable: true,
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-asyncdisposablestack.prototype.move
description: >
Property descriptor of AsyncDisposableStack.prototype.move
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.move, 'function');
verifyProperty(AsyncDisposableStack.prototype, 'move', {
enumerable: false,
writable: true,
configurable: true
});

View File

@ -0,0 +1,18 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The property descriptor AsyncDisposableStack.prototype
esid: sec-properties-of-the-asyncdisposablestack-constructor
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: false }.
features: [explicit-resource-management]
includes: [propertyHelper.js]
---*/
verifyProperty(AsyncDisposableStack, 'prototype', {
writable: false,
enumerable: false,
configurable: false
});

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-asyncdisposablestack.prototype.use
description: >
Property descriptor of AsyncDisposableStack.prototype.use
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.use, 'function');
verifyProperty(AsyncDisposableStack.prototype, 'use', {
enumerable: false,
writable: true,
configurable: true
});

View File

@ -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-%asynciteratorprototype%-@@asyncDispose
description: Property descriptor
info: |
ES6 Section 17
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.
features: [explicit-resource-management]
includes: [propertyHelper.js]
---*/
async function* generator() {}
const AsyncIteratorPrototype = Object.getPrototypeOf(Object.getPrototypeOf(generator.prototype))
verifyProperty(AsyncIteratorPrototype, Symbol.asyncDispose, {
writable: true,
enumerable: false,
configurable: true,
});

View File

@ -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-disposablestack-constructor
description: >
Property descriptor of DisposableStack
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, 'DisposableStack', {
enumerable: false,
writable: true,
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-disposablestack.prototype.adopt
description: >
Property descriptor of DisposableStack.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 DisposableStack.prototype.adopt, 'function');
verifyProperty(DisposableStack.prototype, 'adopt', {
enumerable: false,
writable: true,
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-disposablestack.prototype.defer
description: >
Property descriptor of DisposableStack.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 DisposableStack.prototype.defer, 'function');
verifyProperty(DisposableStack.prototype, 'defer', {
enumerable: false,
writable: true,
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-disposablestack.prototype.dispose
description: >
Property descriptor of DisposableStack.prototype.dispose
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 DisposableStack.prototype.dispose, 'function');
verifyProperty(DisposableStack.prototype, 'dispose', {
enumerable: false,
writable: true,
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-disposablestack.prototype.move
description: >
Property descriptor of DisposableStack.prototype.move
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 DisposableStack.prototype.move, 'function');
verifyProperty(DisposableStack.prototype, 'move', {
enumerable: false,
writable: true,
configurable: true
});

View File

@ -0,0 +1,18 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: The property descriptor DisposableStack.prototype
esid: sec-properties-of-the-disposablestack-constructor
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false,
[[Configurable]]: false }.
features: [explicit-resource-management]
includes: [propertyHelper.js]
---*/
verifyProperty(DisposableStack, 'prototype', {
writable: false,
enumerable: false,
configurable: false
});

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-disposablestack.prototype.use
description: >
Property descriptor of DisposableStack.prototype.use
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 DisposableStack.prototype.use, 'function');
verifyProperty(DisposableStack.prototype, 'use', {
enumerable: false,
writable: true,
configurable: true
});

View File

@ -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-%iteratorprototype%-@@dispose
description: Property descriptor
info: |
ES6 Section 17
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.
features: [explicit-resource-management]
includes: [propertyHelper.js]
---*/
const IteratorPrototype = Object.getPrototypeOf(
Object.getPrototypeOf([][Symbol.iterator]())
);
verifyProperty(IteratorPrototype, Symbol.dispose, {
writable: true,
enumerable: false,
configurable: true,
});

View File

@ -0,0 +1,26 @@
// Copyright (C) 2023 Ron Buckton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-suppressederror-objects
description: >
Property descriptor of SuppressedError
info: |
SuppressedError Objects
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 SuppressedError, 'function');
verifyProperty(this, 'SuppressedError', {
enumerable: false,
writable: true,
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
description: >
Property descriptor of SuppressedError.prototype
info: |
SuppressedError.prototype
The initial value of SuppressedError.prototype is the intrinsic object %AggregateErrorPrototype%.
This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
includes: [propertyHelper.js]
features: [explicit-resource-management]
---*/
assert.sameValue(typeof SuppressedError.prototype, 'object');
verifyProperty(SuppressedError, 'prototype', {
enumerable: false,
writable: false,
configurable: false
});

View File

@ -0,0 +1,17 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: pending
description: >
`Symbol.asyncDispose` property descriptor
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: false }.
includes: [propertyHelper.js]
features: [explicit-resource-management]
---*/
assert.sameValue(typeof Symbol.asyncDispose, 'symbol');
verifyNotEnumerable(Symbol, 'asyncDispose');
verifyNotWritable(Symbol, 'asyncDispose');
verifyNotConfigurable(Symbol, 'asyncDispose');

View File

@ -0,0 +1,17 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: pending
description: >
`Symbol.dispose` property descriptor
info: |
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
false, [[Configurable]]: false }.
includes: [propertyHelper.js]
features: [explicit-resource-management]
---*/
assert.sameValue(typeof Symbol.dispose, 'symbol');
verifyNotEnumerable(Symbol, 'dispose');
verifyNotWritable(Symbol, 'dispose');
verifyNotConfigurable(Symbol, 'dispose');