File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,54 @@ use feature "smartmatch";
43
43
my @x = qw(a b c);
44
44
my $y = "b" ~~ @x;
45
45
EXPECT
46
+ ########
47
+ # NAME smartmatch and switch features independent
48
+ no feature "switch";
49
+ use feature "smartmatch";
50
+ BEGIN {
51
+ print STDERR "switch ",
52
+ feature::feature_enabled("switch") ? "is" : "is not",
53
+ " enabled\n";
54
+ print STDERR "smartmatch ",
55
+ feature::feature_enabled("smartmatch") ? "is" : "is not",
56
+ " enabled\n";
57
+ }
58
+ my @x = qw(a b c);
59
+ my $y = "b" ~~ @x;
60
+ given ($y) {
61
+ when (1) {
62
+ print "fail!";
63
+ }
64
+ }
65
+ EXPECT
66
+ OPTION fatal
67
+ switch is not enabled
68
+ smartmatch is enabled
69
+ syntax error at - line 13, near ") {"
70
+ Execution of - aborted due to compilation errors.
71
+ ########
72
+ # NAME smartmatch and switch features independent
73
+ use feature "switch";
74
+ no feature "smartmatch";
75
+ BEGIN {
76
+ print STDERR "switch ",
77
+ feature::feature_enabled("switch") ? "is" : "is not",
78
+ " enabled\n";
79
+ print STDERR "smartmatch ",
80
+ feature::feature_enabled("smartmatch") ? "is" : "is not",
81
+ " enabled\n";
82
+ }
83
+ my $z;
84
+ given ($z) {
85
+ when (1) {
86
+ print "fail!";
87
+ }
88
+ }
89
+ my @x = qw(a b c);
90
+ my $y = "b" ~~ @x;
91
+ EXPECT
92
+ OPTION fatal
93
+ switch is enabled
94
+ smartmatch is not enabled
95
+ syntax error at - line 18, near ""b" ~"
96
+ Execution of - aborted due to compilation errors.
You can’t perform that action at this time.
0 commit comments