Skip to content

Commit

Permalink
Fix collateral damage to lexsub-related warning tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonerd committed Jan 31, 2024
1 parent d044fb1 commit 21e403b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions t/op/attrproto.t
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ is @warnings, 0, "Malformed prototype isn't just a warning";
{
use feature "lexical_subs";
no warnings "experimental::lexical_subs";
$ret = eval 'my sub foo(bar) : prototype(baz) {}; prototype \&foo;';
is $ret, "baz", "my sub foo honors the prototype attribute";
like shift @warnings, qr/Illegal character in prototype for foo : bar/,
$ret = eval 'my sub lexsub1(bar) : prototype(baz) {}; prototype \&lexsub1;';
is $ret, "baz", "my sub lexsub1 honors the prototype attribute";
like shift @warnings, qr/Illegal character in prototype for lexsub1 : bar/,
"(lexical) bar triggers illegal proto warnings";
like shift @warnings, qr/Illegal character in prototype for foo : baz/,
like shift @warnings, qr/Illegal character in prototype for lexsub1 : baz/,
"(lexical) baz triggers illegal proto warnings";
like shift @warnings, qr/Prototype \'bar\' overridden by attribute \'prototype\(baz\)\' in foo/,
like shift @warnings, qr/Prototype \'bar\' overridden by attribute \'prototype\(baz\)\' in lexsub1/,
"(lexical) overridden warning triggered in anonymous sub";
is @warnings, 0, "No more warnings";
}
Expand Down
12 changes: 6 additions & 6 deletions t/op/lexsub.t
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ package main;
state $w ;
local $SIG{__WARN__} = sub { $w .= shift };
eval '#line 87 squidges
state sub foo;
state sub foo {};
state sub lexsub1;
state sub lexsub1 {};
';
is $w,
'"state" subroutine &foo masks earlier declaration in same scope at '
'"state" subroutine &lexsub1 masks earlier declaration in same scope at '
. "squidges line 88.\n",
'warning for state sub masking earlier declaration';
}
Expand Down Expand Up @@ -584,11 +584,11 @@ package main;
my $w ;
local $SIG{__WARN__} = sub { $w .= shift };
eval '#line 87 squidges
my sub foo;
my sub foo {};
my sub lexsub2;
my sub lexsub2 {};
';
is $w,
'"my" subroutine &foo masks earlier declaration in same scope at '
'"my" subroutine &lexsub2 masks earlier declaration in same scope at '
. "squidges line 88.\n",
'warning for my sub masking earlier declaration';
}
Expand Down

0 comments on commit 21e403b

Please sign in to comment.