From ff581360d8d690879a1ece4e004acc1e3625f7dc Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 29 Dec 2012 18:06:13 +0800 Subject: Replaces internal logic to select implementation with Module::Implementation --- t/bug-rt-78272.t | 4 ++-- t/impl-selection/env.t | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/bug-rt-78272.t b/t/bug-rt-78272.t index c2bfff4..0d6099b 100644 --- a/t/bug-rt-78272.t +++ b/t/bug-rt-78272.t @@ -10,7 +10,7 @@ subtest 'Bug RT-78272: Arbitrary code execution from $ENV' => sub { like( exception { require Package::Stash }, - qr/^Could not load Package::Stash::$e/, + qr/$e is not a valid implementation for Package::Stash/, 'Arbitrary code in $ENV throws exception' ); @@ -19,7 +19,7 @@ subtest 'Bug RT-78272: Arbitrary code execution from $ENV' => sub { delete $INC{'Package/Stash.pm'}; require Package::Stash; }, - qr/^Could not load Package::Stash::$e/, + qr/$e is not a valid implementation for Package::Stash/, 'Sanity check: forcing package reload throws the exception again' ); diff --git a/t/impl-selection/env.t b/t/impl-selection/env.t index 3369488..c050267 100644 --- a/t/impl-selection/env.t +++ b/t/impl-selection/env.t @@ -26,4 +26,14 @@ SKIP: { can_ok('Package::Stash', 'new'); } +{ + delete $Package::{'Stash::'}; + delete $INC{'Package/Stash.pm'}; + set_impl('INVALID'); + $ENV{PACKAGE_STASH_IMPLEMENTATION} = 'PP'; + require Package::Stash; + is(get_impl, 'PP', '$ENV takes precedence over $Package::Stash::IMPLEMENTATION'); + can_ok('Package::Stash', 'new'); +} + done_testing; -- cgit v1.2.3