X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=xt%2Fload_optional.t;h=fda12a262edb1264d9c25434d52401bce495dd81;hp=2e7f510086e77303479c3059ead00dc01c6f5687;hb=710f1c32ba19676990ecda960c9eff96c4002328;hpb=7f5bfc4dfef392ba306ec6967482987afde767b4 diff --git a/xt/load_optional.t b/xt/load_optional.t index 2e7f510..fda12a2 100644 --- a/xt/load_optional.t +++ b/xt/load_optional.t @@ -21,7 +21,10 @@ is exception { my $remote = My::Data::TestModuleRuntime->new::on($connection); is($remote->counter, 0, 'Counter at 0'); is($remote->increment, 1, 'Increment to 1'); - is($remote->has_missing_module, 0, 'Shouldn\'t have loaded module'); + like exception { + my $o = $remote->create_object; + }, qr/Can't locate Not\/Found.pm in \@INC/, 'Should fail to load Not::Found'; + }, undef, 'Checking Module::Runtime use_package_optimistically works correctly.'; done_testing; @@ -51,4 +54,4 @@ has counter => (is => 'rwp', default => sub { 0 }); sub increment { $_[0]->_set_counter($_[0]->counter + 1); } -sub has_missing_module { HAS_MISSING_MODULE }; +sub create_object { use_package_optimistically('Not::Found')->new() };