summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
Diffstat (limited to 't/lib')
-rw-r--r--t/lib/croak/pp_ctl12
-rw-r--r--t/lib/feature/switch104
-rw-r--r--t/lib/warnings/9uninit7
-rw-r--r--t/lib/warnings/op2
-rw-r--r--t/lib/warnings/utf85
5 files changed, 26 insertions, 104 deletions
diff --git a/t/lib/croak/pp_ctl b/t/lib/croak/pp_ctl
index 2943bf7551..5c98769913 100644
--- a/t/lib/croak/pp_ctl
+++ b/t/lib/croak/pp_ctl
@@ -28,14 +28,8 @@ dump $label;
EXPECT
Can't find label foo at - line 3.
########
-# NAME when outside given
+# NAME whereso outside given
use 5.01; no warnings 'experimental::smartmatch';
-when(undef){}
+whereso(!defined){}
EXPECT
-Can't "when" outside a topicalizer at - line 2.
-########
-# NAME default outside given
-use 5.01;
-default{}
-EXPECT
-Can't "default" outside a topicalizer at - line 2.
+Can't leave "whereso" outside a loop block at - line 2.
diff --git a/t/lib/feature/switch b/t/lib/feature/switch
index 0dee7f51cf..5e6269ff0e 100644
--- a/t/lib/feature/switch
+++ b/t/lib/feature/switch
@@ -9,31 +9,17 @@ EXPECT
Unquoted string "given" may clash with future reserved word at - line 3.
given
########
-# No switch; when should be a bareword.
+# No switch; whereso should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
-print STDOUT when;
+print STDOUT whereso;
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';
-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';
-print STDOUT break;
-EXPECT
-Unquoted string "break" may clash with future reserved word at - line 3.
-break
+Unquoted string "whereso" may clash with future reserved word at - line 3.
+whereso
########
# No switch; but continue is still a keyword
print STDOUT continue;
EXPECT
-Can't "continue" outside a when block at - line 2.
+Can't "continue" outside a whereso block at - line 2.
########
# Use switch; so given is a keyword
use feature 'switch'; no warnings 'experimental::smartmatch';
@@ -41,24 +27,12 @@ given("okay\n") { print }
EXPECT
okay
########
-# Use switch; so when is a keyword
-use feature 'switch'; no warnings 'experimental::smartmatch';
-given(1) { when(1) { print "okay" } }
-EXPECT
-okay
-########
-# Use switch; so default is a keyword
+# Use switch; so whereso is a keyword
use feature 'switch'; no warnings 'experimental::smartmatch';
-given(1) { default { print "okay" } }
+given(1) { whereso(1) { print "okay" } }
EXPECT
okay
########
-# Use switch; so break is a keyword
-use feature 'switch';
-break;
-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 feature 'switch';
@@ -70,73 +44,35 @@ Unquoted string "given" may clash with future reserved word at - line 6.
Okay here
given
########
-# switch out of scope; when should be a bareword.
+# switch out of scope; whereso should be a bareword.
use warnings; no warnings 'experimental::smartmatch';
{ use feature 'switch';
- given (1) { when(1) {print "Okay here\n";} }
+ given (1) { whereso(1) {print "Okay here\n";} }
}
-print STDOUT when;
+print STDOUT whereso;
EXPECT
-Unquoted string "when" may clash with future reserved word at - line 6.
+Unquoted string "whereso" may clash with future reserved word at - line 6.
Okay here
-when
-########
-# switch out of scope; default should be a bareword.
-use warnings; no warnings 'experimental::smartmatch';
-{ use feature 'switch';
- given (1) { default {print "Okay here\n";} }
-}
-print STDOUT default;
-EXPECT
-Unquoted string "default" may clash with future reserved word at - line 6.
-Okay here
-default
-########
-# switch out of scope; break should be a bareword.
-use warnings; no warnings 'experimental::smartmatch';
-{ use feature 'switch';
- given (1) { break }
-}
-print STDOUT break;
-EXPECT
-Unquoted string "break" may clash with future reserved word at - line 6.
-break
+whereso
########
# C<no feature 'switch'> should work
use warnings; no warnings 'experimental::smartmatch';
use feature 'switch';
-given (1) { when(1) {print "Okay here\n";} }
+given (1) { whereso(1) {print "Okay here\n";} }
no feature 'switch';
-print STDOUT when;
+print STDOUT whereso;
EXPECT
-Unquoted string "when" may clash with future reserved word at - line 6.
+Unquoted string "whereso" may clash with future reserved word at - line 6.
Okay here
-when
+whereso
########
# C<no feature> should work too
use warnings; no warnings 'experimental::smartmatch';
use feature 'switch';
-given (1) { when(1) {print "Okay here\n";} }
+given (1) { whereso(1) {print "Okay here\n";} }
no feature;
-print STDOUT when;
+print STDOUT whereso;
EXPECT
-Unquoted string "when" may clash with future reserved word at - line 6.
+Unquoted string "whereso" may clash with future reserved word at - line 6.
Okay here
-when
-########
-# Without the feature, no 'Unambiguous use of' warning:
-use warnings; no warnings 'experimental::smartmatch';
-@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 feature 'switch';
-@break = ($break = "break");
-print ${break}, ${break[0]};
-EXPECT
-Ambiguous use of ${break} resolved to $break at - line 5.
-Ambiguous use of ${break[...]} resolved to $break[...] at - line 5.
-breakbreak
+whereso
diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit
index 774c6ee432..3963d66e39 100644
--- a/t/lib/warnings/9uninit
+++ b/t/lib/warnings/9uninit
@@ -1943,13 +1943,6 @@ $v = 1 + prototype $fn;
EXPECT
Use of uninitialized value in addition (+) at - line 4.
########
-use warnings 'uninitialized'; no warnings 'experimental::smartmatch';
-my $v;
-my $fn = sub {};
-$v = 1 + (1 ~~ $fn);
-EXPECT
-Use of uninitialized value in addition (+) at - line 4.
-########
use warnings 'uninitialized';
my $v;
my $f = "";
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index b28c4e9166..23e03dfb63 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -414,7 +414,7 @@ eval { getgrgid 1 }; # OP_GGRGID
eval { getpwnam 1 }; # OP_GPWNAM
eval { getpwuid 1 }; # OP_GPWUID
prototype "foo"; # OP_PROTOTYPE
-$a ~~ $b; # OP_SMARTMATCH
+$a ~~ $b if rand(1)>2; # OP_SMARTMATCH
$a <=> $b; # OP_NCMP
"dsatrewq";
"diatrewq";
diff --git a/t/lib/warnings/utf8 b/t/lib/warnings/utf8
index a9a6388d31..2ac8ac97f6 100644
--- a/t/lib/warnings/utf8
+++ b/t/lib/warnings/utf8
@@ -779,7 +779,6 @@ BEGIN{
}
no warnings;
use warnings 'utf8';
-for(uc 0..t){0~~pack"UXc",exp}
+pack("UXc",168) eq "\xaa";
EXPECT
-OPTIONS regex
-Malformed UTF-8 character: \\x([[:xdigit:]]{2})\\x([[:xdigit:]]{2}) \(unexpected non-continuation byte 0x\2, immediately after start byte 0x\1; need 2 bytes, got 1\) in smart match at - line 9.
+Malformed UTF-8 character: \xc2\x00 (unexpected non-continuation byte 0x00, immediately after start byte 0xc2; need 2 bytes, got 1) in string eq at - line 9.