You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the t-op-caller-bitmask-problem-20201204 branch, which is forked from alpha-dev-03-warnings, I have created a new file, t/op/xcaller.t, which contains a single unit test extracted from t/op/caller.t.
$ cat t/op/xcaller.t
#!./perl
# Tests for caller()
#use warnings;
BEGIN {
chdir 't' if -d 't';
require './test.pl';
set_up_inc('../lib');
plan( tests => 1 ); # some tests are run in a BEGIN block
}
# The bitmask should be assignable to ${^WARNING_BITS} without resulting in
# different warnings settings.
{
my $bits = sub { (caller 0)[9] }->();
my $w;
local $SIG{__WARN__} = sub { $w++ };
eval '
use warnings;
BEGIN { ${^WARNING_BITS} = $bits }
local $^W = 1;
() = 1 + undef;
$^W = 0;
() = 1 + undef;
';
is $w, 1, 'value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS}';
}
Once warnings are on by default (as is the case in the branches cited), this test fails.
$ ./perl -Ilib t/op/xcaller.t
1..1
not ok 1 - value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS}
# Failed test 1 - value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS} at t/op/xcaller.t line 26
# got "2"
# expected "1"
If I were to put this file in a branch in the Perl 5 core distribution -- where warnings are not on by default -- the test would pass.
$ ./perl -Ilib t/op/xcaller.t
1..1
ok 1 - value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS}
However, if I were to edit the file there (in Perl 5) to activate the use warnings; statement, the test would fail.
./perl -Ilib t/op/ycaller.t
1..1
not ok 1 - value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS}
# Failed test 1 - value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS} at t/op/ycaller.t line 26
# got "2"
# expected "1"
So it is clear that turning on warnings by default, causes problems for this test.
In the
t-op-caller-bitmask-problem-20201204
branch, which is forked fromalpha-dev-03-warnings
, I have created a new file,t/op/xcaller.t
, which contains a single unit test extracted fromt/op/caller.t
.Once warnings are on by default (as is the case in the branches cited), this test fails.
If I were to put this file in a branch in the Perl 5 core distribution -- where warnings are not on by default -- the test would pass.
However, if I were to edit the file there (in Perl 5) to activate the
use warnings;
statement, the test would fail.So it is clear that turning on warnings by default, causes problems for this test.
@atoomic, can you take a look?
Thank you very much.
Jim Keenan
The text was updated successfully, but these errors were encountered: