11 no warnings 'experimental::smartmatch';
17 pass "CORE::whereso without feature flag";
25 pass "CORE::whereso with feature flag";
31 pass "whereso with feature flag";
37 is($x, "foo", "whereso lexical scope not started yet");
38 whereso(my $x = ($_ && "bar")) {
39 is($x, "bar", "whereso lexical scope starts");
41 is($x, "foo", "whereso lexical scope ends");
45 whereso($_ == 2) { fail; }
50 whereso($_ == 3) { pass; }
55 whereso($_ == 2) { fail; }
56 whereso($_ == 3) { pass; }
57 whereso($_ == 4) { fail; }
58 whereso($_ == 3) { fail; }
62 whereso(undef) { fail; }
66 foreach(undef, 1, 3) {
71 foreach(undef, 1, 3) {
76 sub is_list_context { wantarray }
77 sub is_scalar_context { !wantarray && defined(wantarray) }
78 sub is_void_context { !defined(wantarray) }
80 whereso(is_list_context()) { fail; }
84 whereso(is_scalar_context()) { pass; }
88 whereso(is_void_context()) { fail; }
92 whereso(is_list_context) { fail; }
96 whereso(is_scalar_context) { pass; }
100 whereso(is_void_context) { fail; }
106 whereso($ps) { pass; }
111 whereso($ps) { fail; }
116 whereso($gs) { pass; }
121 whereso($gs) { fail; }
124 my @pa = qw(a b c d e);
126 whereso(@pa) { pass; }
131 whereso(@pa) { fail; }
134 our @ga = qw(a b c d e);
136 whereso(@ga) { pass; }
141 whereso(@ga) { fail; }
144 my %ph = qw(a b c d e f g h i j);
146 whereso(%ph) { pass; }
151 whereso(%ph) { fail; }
154 our %gh = qw(a b c d e f g h i j);
156 whereso(%gh) { pass; }
161 whereso(%gh) { fail; }
167 whereso($one + 3) { pass; }
171 whereso($one - 1) { fail; }
176 whereso(()) { fail; }
188 $act .= "[a@{[0+@a]}]";
189 whereso(shift(@a) eq "y") {
194 is $act, "[a3][c][a2][b][a1][c]";
199 whereso(0) { $act .= "[b]"; }
201 whereso(1) { $act .= "[d]"; }
203 whereso(1) { $act .= "[f]"; }
205 is $act, "[a][c][d]";