summaryrefslogtreecommitdiff
path: root/t/lib/feature/api
blob: d31a8c6c6d688f0fd96cfa50ac26a59bb7a8f0c6 (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
46
47
48
Test the API

__END__
# NAME test feature enabled by bundle
use feature ();
BEGIN {
   print "default: ", join(" ", feature::features_enabled(0)), "\n";
   print "unicode_strings ", feature::feature_enabled("unicode_strings", 0) ? "is" : "is not",
         " enabled\n";
   print "bundle: ", feature::feature_bundle(0) // "undef", "\n";
}
use v5.12;
BEGIN {
   print "5.12: ", join(" ", feature::features_enabled(0)), "\n";
   print "unicode_strings ", feature::feature_enabled("unicode_strings", 0) ? "is" : "is not",
         " enabled\n";
   print "bundle: ", feature::feature_bundle(0) // "undef", "\n";
}
EXPECT
default: bareword_filehandles indirect multidimensional
unicode_strings is not enabled
bundle: default
5.12: bareword_filehandles indirect multidimensional say state switch unicode_strings
unicode_strings is enabled
bundle: 5.11
########
# NAME test features enabled explicitly
no feature "indirect";
BEGIN {
    print "no feature indirect: ", join(" ", feature::features_enabled(0)), "\n";
    print "indirect ", feature::feature_enabled("indirect", 0) ? "is" : "is not",
         " enabled\n";
   print "bundle: ", feature::feature_bundle(0) // "undef", "\n";
}
use feature "unicode_strings";
BEGIN {
   print "added unicode_strings: ", join(" ", feature::features_enabled(0)), "\n";
   print "unicode_strings ", feature::feature_enabled("unicode_strings", 0) ? "is" : "is not",
         " enabled\n";
   print "bundle: ", feature::feature_bundle(0) // "undef", "\n";
}
EXPECT
no feature indirect: bareword_filehandles multidimensional
indirect is not enabled
bundle: undef
added unicode_strings: bareword_filehandles multidimensional unicode_strings
unicode_strings is enabled
bundle: undef