xref: /openbsd-src/gnu/usr.bin/perl/t/lib/feature/bundle (revision 898184e3e61f9129feb5978fad5a8c6865f00b92)
1Check feature bundles.
2
3__END__
4# Standard feature bundle
5use feature ":5.10";
6say "Hello", "world";
7EXPECT
8Helloworld
9########
10# Standard feature bundle, no 5.11
11use feature ":5.10";
12say ord uc chr 233;
13EXPECT
14233
15########
16# Standard feature bundle, 5.11
17use feature ":5.11";
18say ord uc chr 233;
19EXPECT
20201
21########
22# Standard feature bundle, 5.11
23use feature ":5.11";
24use utf8;
25say ord "\ué"; # this is utf8
26EXPECT
27201
28########
29# more specific: 5.10.0 maps to 5.10
30use feature ":5.10.0";
31say "Hello", "world";
32EXPECT
33Helloworld
34########
35# as does 5.10.1
36use feature ":5.10.1";
37say "Hello", "world";
38EXPECT
39Helloworld
40########
41# as does 5.10.99
42use feature ":5.10.99";
43say "Hello", "world";
44EXPECT
45Helloworld
46########
47# 5.9.5 also supported
48use feature ":5.9.5";
49say "Hello", "world";
50EXPECT
51Helloworld
52########
53# 5.9 not supported
54use feature ":5.9";
55EXPECT
56OPTIONS regex
57^Feature bundle "5.9" is not supported by Perl \d+\.\d+\.\d+ at - line \d+
58########
59# 5.9.4 not supported
60use feature ":5.9.4";
61EXPECT
62OPTIONS regex
63^Feature bundle "5.9.4" is not supported by Perl \d+\.\d+\.\d+ at - line \d+
64########
65# 5.8.8 not supported
66use feature ":5.8.8";
67EXPECT
68OPTIONS regex
69^Feature bundle "5.8.8" is not supported by Perl \d+\.\d+\.\d+ at - line \d+
70########
71# :default
72BEGIN { *say = *state = *given = sub { print "custom sub\n" }; }
73use feature ":default";
74say "yes";
75state my $foo;
76given a => chance;
77EXPECT
78custom sub
79custom sub
80custom sub
81########
82# :default and $[
83# SKIP ? not defined DynaLoader::boot_DynaLoader
84no feature;
85use feature ":default";
86$[ = 1;
87print qw[a b c][2], "\n";
88use feature ":5.16"; # should not disable anything; no feature ':all' does that
89print qw[a b c][2], "\n";
90no feature ':all';
91print qw[a b c][2], "\n";
92use feature ":5.16";
93print qw[a b c][2], "\n";
94EXPECT
95Use of assignment to $[ is deprecated at - line 4.
96b
97b
98c
99c
100########
101# "no feature"
102use feature ':5.16'; # turns array_base off
103no feature; # resets to :default, thus turns array_base on
104$[ = 1;
105print qw[a b c][2], "\n";
106EXPECT
107Use of assignment to $[ is deprecated at - line 4.
108b
109########
110# "no feature 'all"
111$[ = 1;
112print qw[a b c][2], "\n";
113no feature ':all'; # turns array_base (and everything else) off
114$[ = 1;
115print qw[a b c][2], "\n";
116EXPECT
117Use of assignment to $[ is deprecated at - line 2.
118Assigning non-zero to $[ is no longer possible at - line 5.
119b
120