diff --git a/test/staging/explicit-resource-management/disposable-stack-re-entry.js b/test/staging/explicit-resource-management/disposable-stack-re-entry.js new file mode 100644 index 0000000000..4233280853 --- /dev/null +++ b/test/staging/explicit-resource-management/disposable-stack-re-entry.js @@ -0,0 +1,22 @@ +// Copyright (C) 2025 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: Re-entry to a disposable stack should do nothing. +includes: [compareArray.js] +features: [explicit-resource-management] +---*/ + +let values = []; + +(function TestDisposableStackReEntry() { + let stack = new DisposableStack(); + stack.use({ + [Symbol.dispose]() { + values.push(42); + stack.dispose(); + } + }); + stack.dispose(); +})(); +assert.compareArray(values, [42]);