File: api

package info (click to toggle)
perl 5.42.0-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 128,392 kB
  • sloc: perl: 534,963; ansic: 240,563; sh: 72,042; pascal: 6,934; xml: 2,428; yacc: 1,360; makefile: 1,197; cpp: 208; lisp: 1
file content (48 lines) | stat: -rw-r--r-- 1,883 bytes parent folder | download
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: apostrophe_as_package_separator bareword_filehandles indirect multidimensional smartmatch
unicode_strings is not enabled
bundle: default
5.12: apostrophe_as_package_separator bareword_filehandles indirect multidimensional say smartmatch 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: apostrophe_as_package_separator bareword_filehandles multidimensional smartmatch
indirect is not enabled
bundle: undef
added unicode_strings: apostrophe_as_package_separator bareword_filehandles multidimensional smartmatch unicode_strings
unicode_strings is enabled
bundle: undef