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
|