use Cwd (); # cwd
use File::Spec (); # catdir
-use Test::More tests => 42;
+use Test::More tests => 43;
use App::Rgit;
is $res, undef, 'App::Rgit->new(): wrong root: returns undef';
$res = eval {
+ local $ENV{GIT_EXEC_PATH};
+ local $ENV{PATH} = 't/bin';
App::Rgit->new(
root => 't',
);
};
-is $@, '', "App::Rgit->new(): no git: doesn't croak";
-is $res, undef, 'App::Rgit->new(): no git: returns undef';
+is $@, '', "App::Rgit->new(): no git, no GIT_EXEC_PATH: doesn't croak";
+isa_ok $res, 'App::Rgit',
+ 'App::Rgit->new(): no git, no GIT_EXEC_PATH: returns object';
+
+$res = eval {
+ local $ENV{GIT_EXEC_PATH} = 't/bin/git';
+ App::Rgit->new(
+ root => 't',
+ );
+};
+is $@, '', "App::Rgit->new(): no git: doesn't croak";
+isa_ok $res, 'App::Rgit', 'App::Rgit->new(): no git: returns object';
$res = eval {
App::Rgit->new(
git => $0,
);
};
-is $@, '', "App::Rgit->new(): wrong git: doesn't croak";
-is $res, undef, 'App::Rgit->new(): wrong git: returns undef';
+like $@, qr/Couldn't find a proper git executable/,
+ 'App::Rgit->new(): wrong git: croaks';
$res = eval {
App::Rgit->new(