1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
From: Philip Hands <phil@hands.com>
Date: Mon, 15 Jan 2024 11:53:24 +0100
Subject: skip tests that depend on git if not in a repo.
during a standard Debian build, the source is unpacked from a source
package (effectively a tarball) so one is not in a git repo, and cannot
use git grep.
---
xt/01-style.t | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/xt/01-style.t b/xt/01-style.t
index 3afb4b4..c114325 100755
--- a/xt/01-style.t
+++ b/xt/01-style.t
@@ -7,6 +7,12 @@ use Test::Most;
use FindBin '$Bin';
chdir "$Bin/..";
+if (not -e "$Bin/../.git") {
+ pass("Skipping all tests, not in a git repository"); # uncoverable statement
+ done_testing; # uncoverable statement
+ exit; # uncoverable statement
+}
+
ok system(qq{git grep -I -l 'Copyright \((C)\|(c)\|©\)' ':!COPYING' ':!external/'}) != 0, 'No redundant copyright character';
ok system(qq{git grep -I -l 'This program is free software.*if not, see <http://www.gnu.org/licenses/' ':!COPYING' ':!external/' ':!xt/01-style.t'}) != 0, 'No verbatim licenses in source files';
ok system(qq{git grep -I -l '[#/ ]*SPDX-License-Identifier ' ':!COPYING' ':!external/' ':!xt/01-style.t'}) != 0, 'SPDX-License-Identifier correctly terminated';
|