Skip to content

Commit

Permalink
Adds property descriptor tests for explicit resource management objects
Browse files Browse the repository at this point in the history
These are all the prop-desc.js tests from @rbuckton's PR tc39#3866 to make reviewing easier.
  • Loading branch information
rbuckton authored and ioannad committed Jul 29, 2024
1 parent 3b89be9 commit a90e208
Show file tree
Hide file tree
Showing 20 changed files with 450 additions and 0 deletions.
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
});
24 changes: 24 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/adopt/prop-desc.js
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
});
24 changes: 24 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/defer/prop-desc.js
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,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
});
24 changes: 24 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/move/prop-desc.js
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.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
});
18 changes: 18 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/prop-desc.js
Original file line number Diff line number Diff line change
@@ -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
});
24 changes: 24 additions & 0 deletions test/built-ins/AsyncDisposableStack/prototype/use/prop-desc.js
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.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
});
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-%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,
});
22 changes: 22 additions & 0 deletions test/built-ins/DisposableStack/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-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
});
24 changes: 24 additions & 0 deletions test/built-ins/DisposableStack/prototype/adopt/prop-desc.js
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-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
});
24 changes: 24 additions & 0 deletions test/built-ins/DisposableStack/prototype/defer/prop-desc.js
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-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
});
24 changes: 24 additions & 0 deletions test/built-ins/DisposableStack/prototype/dispose/prop-desc.js
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-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
});
24 changes: 24 additions & 0 deletions test/built-ins/DisposableStack/prototype/move/prop-desc.js
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-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
});
18 changes: 18 additions & 0 deletions test/built-ins/DisposableStack/prototype/prop-desc.js
Original file line number Diff line number Diff line change
@@ -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
});
24 changes: 24 additions & 0 deletions test/built-ins/DisposableStack/prototype/use/prop-desc.js
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-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
});
23 changes: 23 additions & 0 deletions test/built-ins/Iterator/prototype/Symbol.dispose/prop-desc.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-%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,
});
Loading

0 comments on commit a90e208

Please sign in to comment.