diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-01-22 09:13:06 -0800 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-01-22 09:13:06 -0800 |
commit | b80006332c52b13b3c5eaae92d362fb20992a65c (patch) | |
tree | 5e4c6273f6e5fc0bd67e4101308c1d1c72de469c /t/basic.t | |
parent | f0153f9e0aa32910bef579d7956e59d933108261 (diff) | |
parent | a117735e35a304fbf9a1c1ad1139d2845e2bf39e (diff) | |
download | class-refresh-b80006332c52b13b3c5eaae92d362fb20992a65c.tar.gz class-refresh-b80006332c52b13b3c5eaae92d362fb20992a65c.zip |
Merge pull request #2 from amacleay/master
Do not die if last require failed
Diffstat (limited to 't/basic.t')
-rw-r--r-- | t/basic.t | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -2,8 +2,10 @@ use strict; use warnings; use Test::More; +use Test::Fatal; use lib 't/lib'; use Test::Class::Refresh; +use Try::Tiny; use Class::Refresh; @@ -37,4 +39,14 @@ is(eval '$Foo::FOO', 10, "package global exists with new value"); ok(!defined(eval '$Foo::BAR'), "other package global doesn't exist"); is(eval '$Foo::BAZ', 30, "third package global exists"); +try { require Bar } catch { "We expect this to fail, that's alright and happens sometimes" }; +Class::Refresh->refresh; +ok(exists $INC{'Bar.pm'}, "Failed package \$INC value exists"); +ok(!defined $INC{'Bar.pm'}, "Failed package \$INC value is not defined after failed load"); + +# Now do the same thing to validate that there's no error in repopulating %CACHE +isnt(exception{ Class::Refresh->refresh }, "Second refresh is not an error"); +ok(exists $INC{'Bar.pm'}, "Failed package \$INC value exists: second attempt"); +ok(!defined $INC{'Bar.pm'}, "Failed package \$INC value is not defined after failed load: second attempt"); + done_testing; |