July 12 2020 |
What's Happening in That core-p7 Branch? |
Back
Next
|
use constant roref=>\2;
{
# Suppress an unimportant warning
no warnings 'once';
# Capture important warnings
my @these_warnings = ();
local $SIG{__WARN__} = sub { push @these_warnings, $_[0]; };
eval { for (roref) { $_ = <Fʜ> } };
like($@, qr/Modification of a read-only value attempted/, '[perl #19566]');
# Test that we got the warnings we expected
my $warnings_count = 0;
for my $w (@these_warnings) {
chomp $w;
if ($w =~ m/^readline\(\) on unopened filehandle/) {
$warnings_count++;
}
}
is($warnings_count, 1,
"Got expected number of 'unopened' warnings");
}