This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
when cloning PL_regex_pad, copy SVf_BREAK flag too
[perl5.git] / t / lib / feature / smartmatch
CommitLineData
0d863452
RH
1Check the lexical scoping of the switch keywords.
2(The actual behaviour is tested in t/op/smartmatch.t)
3
4__END__
5# No ~~; should be a syntax error.
6use warnings;
7print +(2 ~~ 2);
8EXPECT
9syntax error at - line 3, near "2 ~"
10Execution of - aborted due to compilation errors.
11########
12# With ~~, should work
13use warnings;
14use feature "~~";
15print +(2 ~~ 2);
16EXPECT
171
18########
19# ~~ out of scope; should be a syntax error.
20use warnings;
21{ use feature '~~'; }
22print +(2 ~~ 2);
23EXPECT
24syntax error at - line 4, near "2 ~"
25Execution of - aborted due to compilation errors.
26########
27# 'no feature' should work
28use warnings;
29use feature '~~';
30print +(2 ~~ 2), "\n";
31no feature;
32print +(2 ~~ 2), "\n";
33EXPECT
34syntax error at - line 6, near "2 ~"
35Execution of - aborted due to compilation errors.
36########
37# 'no feature "~~"' should work too
38use warnings;
39use feature '~~';
40print +(2 ~~ 2), "\n";
41no feature "~~";
42print +(2 ~~ 2), "\n";
43EXPECT
44syntax error at - line 6, near "2 ~"
45Execution of - aborted due to compilation errors.