-
Notifications
You must be signed in to change notification settings - Fork 589
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
base: blead
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local $::TODO = 'GH 5835'; | ||
my $results = fresh_perl(<<~'EOF', {}); | ||
$^W = 1; | ||
print "$^W"; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
The requested change actually would lead to this not doing the right thing, as I explained
I don't think it needs the |
Add todo test for #5835.