summaryrefslogtreecommitdiff
path: root/t/lib/feature/smartmatch
blob: 16ea7f8a923e10206de5fae562dd9471e2f57184 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Check the lexical scoping of the switch keywords.
(The actual behaviour is tested in t/op/smartmatch.t)

__END__
# No ~~; should be a syntax error.
use warnings;
print +(2 ~~ 2);
EXPECT
syntax error at - line 3, near "2 ~"
Execution of - aborted due to compilation errors.
########
# With ~~, should work
use warnings;
use feature "~~";
print +(2 ~~ 2);
EXPECT
1
########
# ~~ out of scope; should be a syntax error.
use warnings;
{ use feature '~~'; }
print +(2 ~~ 2);
EXPECT
syntax error at - line 4, near "2 ~"
Execution of - aborted due to compilation errors.
########
# 'no feature' should work
use warnings;
use feature '~~';
print +(2 ~~ 2), "\n";
no feature;
print +(2 ~~ 2), "\n";
EXPECT
syntax error at - line 6, near "2 ~"
Execution of - aborted due to compilation errors.
########
# 'no feature "~~"' should work too
use warnings;
use feature '~~';
print +(2 ~~ 2), "\n";
no feature "~~";
print +(2 ~~ 2), "\n";
EXPECT
syntax error at - line 6, near "2 ~"
Execution of - aborted due to compilation errors.