Skip to content

todo test for GH 5835 (local($^W) does not work correctly) #23546

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

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

1-1sam
Copy link
Contributor

@1-1sam 1-1sam commented Aug 6, 2025

Add todo test for #5835.


  • This set of changes does not require a perldelta entry.

jkeenan
jkeenan previously requested changes Aug 6, 2025
Copy link
Contributor

@jkeenan jkeenan left a comment

Choose a reason for hiding this comment

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

@mauke, since you were the last person to meaningfully comment in GH #5835 (11 years ago!), could you take a look at this ticket? Thanks.

local $::TODO = 'GH 5835';
my $results = fresh_perl(<<~'EOF', {});
$^W = 1;
print "$^W";
Copy link
Contributor

Choose a reason for hiding this comment

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

This print statement and the two subsequent ones may have been useful in preparing this pull request, but they don't actually print when the test is run and don't add anything to the logic of the test. They should be removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm unclear that we need to use fresh_perl for this test.

But the print statements are what cause the 111 being placed into $results. That's what fresh_perl does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose to run the code under fresh_perl so that the fiddling with the $^W switch wouldn't interfere with the state of $^W in subsequent tests.

print "$^W";
EOF
is($?, 0, 'perl exited normally');
is($results, '111', 'localized $^W behaves like ordinary localized scalar');
Copy link
Contributor

Choose a reason for hiding this comment

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

It's not evident to me why 111 should be the expected value (2nd argument) in this unit test.

Copy link
Contributor

Choose a reason for hiding this comment

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

So, the first print is responsible for the first 1. That is the correct value.
The 2nd print is responsible for the second 1. That is the correct value.
And the 3rd print is responsible for the third 1. That is the correct value.

So the desired value is 111. But it isn't. So the test fails, but the TODO makes it expect failure, so the failure doesn't count towards the entire file failing or not. If the result were 111, the test would unexpectedly pass, and that fact would be noted in the output

@khwilliamson khwilliamson dismissed jkeenan’s stale review August 8, 2025 17:02

The requested change actually would lead to this not doing the right thing, as I explained

@tonycoz
Copy link
Contributor

tonycoz commented Aug 11, 2025

I don't think it needs the fresh_perl() - the original issue isn't a crash bug, and #5835 isn't caused by a fault that could lead to a crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants