diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-01-03 21:47:22 -0600 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-01-03 21:47:22 -0600 |
commit | c75c703b03c7f8940ff551b2a9b82b48b22169cb (patch) | |
tree | d13cce2ebbbf9584f6848667530fb5aed103770f /t/impl-selection/bug-rt-78272.t | |
parent | da8549a8440a578cb29ff0011a5214e287979d94 (diff) | |
download | package-stash-c75c703b03c7f8940ff551b2a9b82b48b22169cb.tar.gz package-stash-c75c703b03c7f8940ff551b2a9b82b48b22169cb.zip |
move this test to the right place and clean it up
Diffstat (limited to 't/impl-selection/bug-rt-78272.t')
-rw-r--r-- | t/impl-selection/bug-rt-78272.t | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/t/impl-selection/bug-rt-78272.t b/t/impl-selection/bug-rt-78272.t new file mode 100644 index 0000000..dc74922 --- /dev/null +++ b/t/impl-selection/bug-rt-78272.t @@ -0,0 +1,39 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +use Test::Fatal; + +# https://rt.cpan.org/Public/Bug/Display.html?id=78272 +my $e = $ENV{PACKAGE_STASH_IMPLEMENTATION} = "PP; exit 1"; + +like( + exception { require Package::Stash }, + qr/$e is not a valid implementation for Package::Stash/, + 'Arbitrary code in $ENV throws exception' +); + +like( + exception { + delete $INC{'Package/Stash.pm'}; + require Package::Stash; + }, + qr/$e is not a valid implementation for Package::Stash/, + 'Sanity check: forcing package reload throws the exception again' +); + +is( + exception { + $ENV{PACKAGE_STASH_IMPLEMENTATION} = "PP"; + delete $INC{'Package/Stash.pm'}; + require Package::Stash; + new_ok( + 'Package::Stash' => ['Foo'], + 'Loaded and able to create instances' + ); + }, + undef, + 'Valid $ENV value loads correctly' +); + +done_testing; |