]> Dogcows Code - chaz/git-codeowners/commitdiff
do not die in test if there is no git executable
authorCharles McGarvey <chazmcgarvey@brokenzipper.com>
Wed, 13 Nov 2019 03:48:50 +0000 (20:48 -0700)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Wed, 13 Nov 2019 03:48:50 +0000 (20:48 -0700)
t/app-codeowners-util.t
t/app-codeowners.t

index af153e9566a95e1ede32c57782e2729cb9358421..2edbcc79122b0f855a341688ff37bc3b4856aaf8 100644 (file)
@@ -51,7 +51,9 @@ subtest 'git_toplevel' => sub {
 };
 
 subtest 'find_nearest_codeowners' => sub {
+    plan skip_all => 'Cannot run git' if !$can_git;
     my $repodir =_setup_git_repo();
+
     $repodir->child('docs')->mkpath;
     my $filepath = _spew_codeowners($repodir->child('docs/CODEOWNERS'));
 
@@ -60,9 +62,10 @@ subtest 'find_nearest_codeowners' => sub {
 };
 
 subtest 'find_codeowners_in_directory' => sub {
+    plan skip_all => 'Cannot run git' if !$can_git;
     my $repodir =_setup_git_repo();
-    $repodir->child('docs')->mkpath;
 
+    $repodir->child('docs')->mkpath;
     my $filepath = _spew_codeowners($repodir->child('docs/CODEOWNERS'));
 
     my $r = App::Codeowners::Util::find_codeowners_in_directory($repodir);
@@ -77,7 +80,8 @@ done_testing;
 exit;
 
 sub _can_git {
-    my (undef, $version) = run_git('--version');
+    my (undef, $version) = eval { run_git('--version') };
+    note $@ if $@;
     note "Found: $version" if $version;
     return $version && $version ge 'git version 1.8.5';     # for -C flag
 }
index e3a1e2ea9afae009084ee1143eaf8f965dce2368..64415394b69acb1e0b01d6ac004d90d789123fb4 100644 (file)
@@ -76,7 +76,8 @@ done_testing;
 exit;
 
 sub _can_git {
-    my (undef, $version) = run_git('--version');
+    my (undef, $version) = eval { run_git('--version') };
+    note $@ if $@;
     note "Found: $version" if $version;
     return $version && $version ge 'git version 1.8.5';     # for -C flag
 }
This page took 0.020893 seconds and 4 git commands to generate.