X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Frgit.git;a=blobdiff_plain;f=t%2F15-failures.t;fp=t%2F15-failures.t;h=cf6568b871b5787ad0f4240d959a0866b86daba7;hp=0e31edd4382297098cce2fd4f640905b766aa748;hb=569b85b70a20cac15bc2ff0bed6df11ac0e844ec;hpb=1df4b5b8d8d71567094a0c6ec3702ab71b614bd9 diff --git a/t/15-failures.t b/t/15-failures.t index 0e31edd..cf6568b 100644 --- a/t/15-failures.t +++ b/t/15-failures.t @@ -6,25 +6,32 @@ use warnings; use Cwd (); # cwd use File::Spec (); # catdir -use Test::More tests => 43; +use Test::More tests => 44; use App::Rgit; local $SIG{__WARN__} = sub { die @_ }; my $res = eval { - App::Rgit->new() + local $ENV{GIT_DIR}; + App::Rgit->new(); }; -is $@, '', "App::Rgit->new(): no root: doesn't croak"; -is $res, undef, 'App::Rgit->new(): no root: returns undef'; +is $@, '', "App::Rgit->new(): no root, no GIT_DIR: doesn't croak"; +isa_ok $res,'App::Rgit','App::Rgit->new(): no root, no GIT_DIR: returns object'; + +$res = eval { + local $ENV{GIT_DIR} = Cwd::cwd; + App::Rgit->new(); +}; +is $@, '', "App::Rgit->new(): no root: doesn't croak"; +isa_ok $res, 'App::Rgit', 'App::Rgit->new(): no root: returns object'; $res = eval { App::Rgit->new( root => $0, ); }; -is $@, '', "App::Rgit->new(): wrong root: doesn't croak"; -is $res, undef, 'App::Rgit->new(): wrong root: returns undef'; +like $@, qr/Invalid root directory/, 'App::Rgit->new(): wrong root: croaks'; $res = eval { local $ENV{GIT_EXEC_PATH};