From 81bccfe42ad445b6e06432af7d7657baccd86a50 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 8 Dec 2011 08:42:31 -0800 Subject: [PATCH] Fix use VERSION test failures under PERL_UNICODE MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit use VERSION now checks whether HINT_LOCALIZE_HH is set, which indi- cates that %^H has been modified. If it is set, it does ‘no feature’ first, regardless of the version number. Some tests were checking that feature.pm is not loaded for use 5.8.8. Now it is sometimes, particularly if PERL_UNICODE has been set, as it adds keys to %^H. For now, I’ve tweaked the tests. It would be nice if version declara- tions could load and unload features without loading feature.pm, just as they do with strictures. --- t/lib/feature/implicit | 6 +++--- t/op/override.t | 10 ++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/t/lib/feature/implicit b/t/lib/feature/implicit index 3a82f01..e2ae95a 100644 --- a/t/lib/feature/implicit +++ b/t/lib/feature/implicit @@ -25,11 +25,11 @@ say defined $INC{"feature.pm"} ? "Helloworld" : "Good bye"; EXPECT Helloworld ######## -# VERSION requirement, doesn't load anything for < 5.9.5 +# VERSION requirement, doesn't call feature->import for < 5.9.5 +BEGIN { ++$INC{"feature.pm"} } +sub feature::import { print "improting\n" } use 5.8.8; -print "<".$INC{"feature.pm"}.">\n"; EXPECT -<> ######## # VERSION requirement, doesn't load anything with require require 5.9.5; diff --git a/t/op/override.t b/t/op/override.t index ab2cbf1..be39cf9 100644 --- a/t/op/override.t +++ b/t/op/override.t @@ -49,8 +49,14 @@ is( $r, "Foo.pm" ); eval "use Foo::Bar"; is( $r, join($dirsep, "Foo", "Bar.pm") ); -eval "use 5.006"; -is( $r, "5.006" ); +# Under PERL_UNICODE, %^H is set, causing Perl_utilize to require +# feature.pm after 5.006, in order to turn off features. Stop that +# from interfering with this test by unsetting HINT_LOCALIZE_HH. +{ + BEGIN { $^H &= ~0x00020000 } # HINT_LOCALIZE_HH + eval "use 5.006"; + is( $r, "5.006" ); +} { local $_ = 'foo.pm'; -- 2.7.4