Skip to content

Commit

Permalink
Replace 'experimental::smartmatch' by 'deprecated' in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
book authored and demerphq committed Feb 24, 2023
1 parent 381382f commit 8a487d3
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 39 deletions.
2 changes: 1 addition & 1 deletion dist/Safe/t/safeops.t
Expand Up @@ -453,7 +453,7 @@ dor $x // $y
dorassign $x //= $y
once SKIP {use feature 'state'; state $foo = 42;}
say SKIP {use feature 'say'; say "foo";}
smartmatch no warnings 'experimental::smartmatch'; $x ~~ $y
smartmatch no warnings 'deprecated'; $x ~~ $y
aeach SKIP each @t
akeys SKIP keys @t
avalues SKIP values @t
Expand Down
10 changes: 5 additions & 5 deletions lib/B/Deparse.t
Expand Up @@ -1061,7 +1061,7 @@ my $c = [];
my $d = \[];
####
# SKIP ?$] < 5.010 && "smartmatch and given/when not implemented on this Perl version"
# CONTEXT use feature ':5.10'; no warnings 'experimental::smartmatch';
# CONTEXT use feature ':5.10'; no warnings 'deprecated';
# implicit smartmatch in given/when
given ('foo') {
when ('bar') { continue; }
Expand Down Expand Up @@ -1624,7 +1624,7 @@ my @a;
$a[0] = 1;
####
# feature features without feature
# CONTEXT no warnings 'experimental::smartmatch';
# CONTEXT no warnings 'deprecated';
CORE::state $x;
CORE::say $x;
CORE::given ($x) {
Expand All @@ -1640,7 +1640,7 @@ CORE::evalbytes '';
() = CORE::fc $x;
####
# feature features when feature has been disabled by use VERSION
# CONTEXT no warnings 'experimental::smartmatch';
# CONTEXT no warnings 'deprecated';
use feature (sprintf(":%vd", $^V));
use 1;
CORE::say $_;
Expand Down Expand Up @@ -1670,7 +1670,7 @@ CORE::evalbytes '';
() = CORE::__SUB__;
####
# (the above test with CONTEXT, and the output is equivalent but different)
# CONTEXT use feature ':5.10'; no warnings 'experimental::smartmatch';
# CONTEXT use feature ':5.10'; no warnings 'deprecated';
# feature features when feature has been disabled by use VERSION
use feature (sprintf(":%vd", $^V));
use 1;
Expand Down Expand Up @@ -1704,7 +1704,7 @@ CORE::evalbytes '';
####
# SKIP ?$] < 5.017004 && "lexical subs not implemented on this Perl version"
# lexical subroutines and keywords of the same name
# CONTEXT use feature 'lexical_subs', 'switch'; no warnings 'experimental';
# CONTEXT use feature 'lexical_subs', 'switch'; no warnings 'experimental'; no warnings 'deprecated';
my sub default;
my sub else;
my sub elsif;
Expand Down
8 changes: 4 additions & 4 deletions lib/overload.t
Expand Up @@ -1910,7 +1910,7 @@ foreach my $op (qw(<=> == != < <= > >=)) {


for my $sub (keys %subs) {
no warnings 'experimental::smartmatch';
no warnings 'deprecated';
my $term = $subs{$sub};
my $t = sprintf $term, '$_[0][0]';
my $e ="sub { \$funcs .= '($sub)'; my \$r; if (\$use_int) {"
Expand Down Expand Up @@ -1952,7 +1952,7 @@ foreach my $op (qw(<=> == != < <= > >=)) {
? "-\$_[0][0]"
: "$_[3](\$_[0][0])";
my $r;
no warnings 'experimental::smartmatch';
no warnings 'deprecated';
if ($use_int) {
use integer; $r = eval $e;
}
Expand Down Expand Up @@ -1999,7 +1999,7 @@ foreach my $op (qw(<=> == != < <= > >=)) {
$use_int = ($int ne '');
my $plain = $tainted_val;
my $plain_term = $int . sprintf $sub_term, '$plain';
my $exp = do {no warnings 'experimental::smartmatch'; eval $plain_term };
my $exp = do {no warnings 'deprecated'; eval $plain_term };
diag("eval of plain_term <$plain_term> gave <$@>") if $@;
SKIP: {
is_if_taint_supported(tainted($exp), $exp_taint,
Expand Down Expand Up @@ -2029,7 +2029,7 @@ foreach my $op (qw(<=> == != < <= > >=)) {

my $res_term = $int . sprintf $sub_term, $var;
my $desc = "<$res_term> $ov_pkg" ;
my $res = do { no warnings 'experimental::smartmatch'; eval $res_term };
my $res = do { no warnings 'deprecated'; eval $res_term };
diag("eval of res_term $desc gave <$@>") if $@;
# uniquely, the inc/dec ops return the original
# ref rather than a copy, so stringify it to
Expand Down
2 changes: 1 addition & 1 deletion t/lib/croak/pp_ctl
Expand Up @@ -41,7 +41,7 @@ EXPECT
Can't find label foo at - line 3.
########
# NAME when outside given
use 5.01; no warnings 'experimental::smartmatch';
use 5.01; no warnings 'deprecated';
when(undef){}
EXPECT
Can't "when" outside a topicalizer at - line 2.
Expand Down
30 changes: 15 additions & 15 deletions t/lib/feature/switch
Expand Up @@ -3,28 +3,28 @@ Check the lexical scoping of the switch keywords.

__END__
# No switch; given should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
print STDOUT given;
EXPECT
Unquoted string "given" may clash with future reserved word at - line 3.
given
########
# No switch; when should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
print STDOUT when;
EXPECT
Unquoted string "when" may clash with future reserved word at - line 3.
when
########
# No switch; default should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
print STDOUT default;
EXPECT
Unquoted string "default" may clash with future reserved word at - line 3.
default
########
# No switch; break should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
print STDOUT break;
EXPECT
Unquoted string "break" may clash with future reserved word at - line 3.
Expand All @@ -36,19 +36,19 @@ EXPECT
Can't "continue" outside a when block at - line 2.
########
# Use switch; so given is a keyword
use feature 'switch'; no warnings 'experimental::smartmatch';
use feature 'switch'; no warnings 'deprecated';
given("okay\n") { print }
EXPECT
okay
########
# Use switch; so when is a keyword
use feature 'switch'; no warnings 'experimental::smartmatch';
use feature 'switch'; no warnings 'deprecated';
given(1) { when(1) { print "okay" } }
EXPECT
okay
########
# Use switch; so default is a keyword
use feature 'switch'; no warnings 'experimental::smartmatch';
use feature 'switch'; no warnings 'deprecated';
given(1) { default { print "okay" } }
EXPECT
okay
Expand All @@ -60,7 +60,7 @@ EXPECT
Can't "break" outside a given block at - line 3.
########
# switch out of scope; given should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
{ use feature 'switch';
given (1) {print "Okay here\n";}
}
Expand All @@ -71,7 +71,7 @@ Okay here
given
########
# switch out of scope; when should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
{ use feature 'switch';
given (1) { when(1) {print "Okay here\n";} }
}
Expand All @@ -82,7 +82,7 @@ Okay here
when
########
# switch out of scope; default should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
{ use feature 'switch';
given (1) { default {print "Okay here\n";} }
}
Expand All @@ -93,7 +93,7 @@ Okay here
default
########
# switch out of scope; break should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
{ use feature 'switch';
given (1) { break }
}
Expand All @@ -103,7 +103,7 @@ Unquoted string "break" may clash with future reserved word at - line 6.
break
########
# C<no feature 'switch'> should work
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
use feature 'switch';
given (1) { when(1) {print "Okay here\n";} }
no feature 'switch';
Expand All @@ -114,7 +114,7 @@ Okay here
when
########
# C<no feature> should work too
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
use feature 'switch';
given (1) { when(1) {print "Okay here\n";} }
no feature;
Expand All @@ -125,14 +125,14 @@ Okay here
when
########
# Without the feature, no 'Unambiguous use of' warning:
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
@break = ($break = "break");
print ${break}, ${break[0]};
EXPECT
breakbreak
########
# With the feature, we get an 'Unambiguous use of' warning:
use warnings; no warnings 'experimental::smartmatch';
use warnings; no warnings 'deprecated';
use feature 'switch';
@break = ($break = "break");
print ${break}, ${break[0]};
Expand Down
2 changes: 1 addition & 1 deletion t/lib/warnings/9uninit
Expand Up @@ -1943,7 +1943,7 @@ $v = 1 + prototype $fn;
EXPECT
Use of uninitialized value in addition (+) at - line 4.
########
use warnings 'uninitialized'; no warnings 'experimental::smartmatch';
use warnings 'uninitialized'; no warnings 'deprecated';
my $v;
my $fn = sub {};
$v = 1 + (1 ~~ $fn);
Expand Down
2 changes: 1 addition & 1 deletion t/lib/warnings/op
Expand Up @@ -363,7 +363,7 @@ OPTION fatal
Can't use an array as a reference at - line 3.
########
# op.c
use warnings 'void' ; no warnings 'experimental::smartmatch'; close STDIN ;
use warnings 'void' ; no warnings 'deprecated'; close STDIN ;
#line 2
1 x 3 ; # OP_REPEAT (folded)
(1) x 3 ; # OP_REPEAT
Expand Down
4 changes: 3 additions & 1 deletion t/op/cmpchain.t
Expand Up @@ -7,26 +7,28 @@ BEGIN {
}

use feature "isa";
no warnings qw(experimental::smartmatch);

my @cheqop = qw(== != eq ne);
my @nceqop = qw(<=> cmp ~~);
my @chrelop = qw(< > <= >= lt gt le ge);
my @ncrelop = qw(isa);

foreach my $c0 (@nceqop) {
no warnings qw(deprecated);
foreach my $c1 (@nceqop) {
is eval("sub { \$a $c0 \$b $c1 \$c }"), undef,
"$c0 $c1 non-associative";
}
}
foreach my $c (@nceqop) {
no warnings qw(deprecated);
foreach my $e (@cheqop) {
is eval("sub { \$a $c \$b $e \$c }"), undef, "$c $e non-associative";
is eval("sub { \$a $e \$b $c \$c }"), undef, "$e $c non-associative";
}
}
foreach my $c (@nceqop) {
no warnings qw(deprecated);
foreach my $e0 (@cheqop) {
foreach my $e1 (@cheqop) {
is eval("sub { \$a $c \$b $e0 \$c $e1 \$d }"), undef,
Expand Down
4 changes: 2 additions & 2 deletions t/op/coreamp.t
Expand Up @@ -15,8 +15,6 @@ BEGIN {
$^P |= 0x100; # Provide informative "file" names for evals
}

no warnings 'experimental::smartmatch';

sub lis($$;$) {
&is(map(@$_ ? "[@{[map $_//'~~u~~', @$_]}]" : 'nought', @_[0,1]), $_[2]);
}
Expand Down Expand Up @@ -375,6 +373,7 @@ test_proto 'break';
{
$tests ++;
my $tmp;
no warnings 'deprecated';
CORE::given(1) {
CORE::when(1) {
&mybreak;
Expand Down Expand Up @@ -463,6 +462,7 @@ SKIP:

test_proto 'continue';
$tests ++;
no warnings 'deprecated';
CORE::given(1) {
CORE::when(1) {
&mycontinue();
Expand Down
8 changes: 4 additions & 4 deletions t/op/smartmatch.t
Expand Up @@ -8,7 +8,7 @@ BEGIN {
use strict;
use warnings;
no warnings 'uninitialized';
no warnings 'experimental::smartmatch';
no warnings 'deprecated'; # smartmatch is deprecated and will be removed in 5.042

++$|;

Expand Down Expand Up @@ -146,7 +146,7 @@ sub NOT_DEF() { undef }
# re-introduced it will probably crash in one of the many smoke
# builds.
fresh_perl_is('print (q(x) ~~ q(x)) | (/x/ ~~ %!)', "1",
{ switches => [ "-MErrno", "-M-warnings=experimental::smartmatch" ] },
{ switches => [ "-MErrno", "-M-warnings=deprecated" ] },
"don't fill the stack with rubbish");
}

Expand Down Expand Up @@ -194,10 +194,10 @@ sub NOT_DEF() { undef }
# if there was some other operator's arguments left on the stack, as with
# the test cases.
fresh_perl_is('print(0->[0 =~ qr/1/ ~~ 0])', '',
{ switches => [ "-M-warnings=experimental::smartmatch" ] },
{ switches => [ "-M-warnings=deprecated" ] },
"don't qr-ify left-side match against a stacked argument");
fresh_perl_is('print(0->[0 ~~ (0 =~ qr/1/)])', '',
{ switches => [ "-M-warnings=experimental::smartmatch" ] },
{ switches => [ "-M-warnings=deprecated" ] },
"don't qr-ify right-side match against a stacked argument");
}

Expand Down
2 changes: 1 addition & 1 deletion t/op/state.t
Expand Up @@ -346,7 +346,7 @@ foreach my $x (0 .. 4) {
#
my @spam = qw [spam ham bacon beans];
foreach my $spam (@spam) {
no warnings 'experimental::smartmatch';
no warnings 'deprecated';
given (state $spam = $spam) {
when ($spam [0]) {ok 1, "given"}
default {ok 0, "given"}
Expand Down
2 changes: 1 addition & 1 deletion t/op/switch.t
Expand Up @@ -8,7 +8,7 @@ BEGIN {

use strict;
use warnings;
no warnings 'experimental::smartmatch';
no warnings 'deprecated';

plan tests => 197;

Expand Down
3 changes: 2 additions & 1 deletion t/op/taint.t
Expand Up @@ -2453,6 +2453,7 @@ EOF
my $desc = "tainted value returned from " . shift(@descriptions);

my $res = do {
no warnings 'deprecated';
given ($_) {
when ('x') { $letter }
when ('y') { goto leavegiven }
Expand Down Expand Up @@ -2482,7 +2483,7 @@ EOF
# Tainted values with smartmatch
# [perl #93590] S_do_smartmatch stealing its own string buffers
{
no warnings 'experimental::smartmatch';
no warnings 'deprecated';
ok "M$TAINT" ~~ ['m', 'M'], '$tainted ~~ ["whatever", "match"]';
ok !("M$TAINT" ~~ ['m', undef]), '$tainted ~~ ["whatever", undef]';
}
Expand Down
2 changes: 1 addition & 1 deletion t/op/tie_fetch_count.t
Expand Up @@ -165,7 +165,7 @@ $_ = "foo";
$dummy = $var =~ m/ / ; check_count 'm//';
$dummy = $var =~ s/ //; check_count 's///';
{
no warnings 'experimental::smartmatch';
no warnings 'deprecated';
$dummy = $var ~~ 1 ; check_count '~~';
}
$dummy = $var =~ y/ //; check_count 'y///';
Expand Down

0 comments on commit 8a487d3

Please sign in to comment.