Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a test using console.log instead of print #4110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ assert.compareArray(valuesNormal, [44, 43, 42]);
function TestDisposableStackDeferOnDisposedStack() {
let stack = new DisposableStack();
stack.dispose();
stack.defer(() => console.log(42));
stack.defer(() => print(42));
Copy link
Member

@leobalter leobalter Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stack.defer(() => print(42));
stack.defer(() => { throw new Error("Code should not reach here"); });
throw new Error("Code should not reach here");

It's been a while I use Test262, but I believe this might resolve the issue better and confirm no run runs post .defer as well.

Copy link
Member

@leobalter leobalter Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given

3. If disposableStack.[[DisposableState]] is disposed, throw a ReferenceError exception.
4. If IsCallable(onDispose) is false, throw a TypeError exception.

Line 52 can also use a simple stack.defer(''); so it can observe the ReferenceError in the correct order.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that would work as well.

};

assert.throws(
Expand Down
Loading