Skip to contentSkip to conversation

Fold test-absolute-path into test-path-utils

PATCH In review David Reiss 1 participant 1 message Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 Fold test-absolute-path into test-path-utils

---
Completely unnecessary. I just thought it might be nice to combine these to cut down on the number of test driver functions.

 .gitignore           |    1 -
 Makefile             |    2 +-
 t/t0000-basic.sh     |    8 ++++----
 test-absolute-path.c |   11 -----------
 test-path-utils.c    |    8 ++++++++
 5 files changed, 13 insertions(+), 17 deletions(-)
 delete mode 100644 test-absolute-path.c
.gitignore +0 -1
index c54c473..31ea9f1 100644
@@ -142,7 +142,6 @@ git-write-tree
 git-core-*/?*
 gitk-wish
 gitweb/gitweb.cgi
-test-absolute-path
 test-chmtime
 test-date
 test-delta
Makefile +1 -1
index d76c16b..cda7ab1 100644
@@ -1182,7 +1182,7 @@ endif
 
 ### Testing rules
 
-TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-absolute-path$X test-parse-options$X test-path-utils$X
+TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-parse-options$X test-path-utils$X
 
 all:: $(TEST_PROGRAMS)
 
t/t0000-basic.sh +4 -4
index 27b54cb..9745f25 100755
@@ -301,14 +301,14 @@ test_expect_success 'absolute path works as expected' '
 	mkdir third &&
 	dir="$(cd .git; pwd -P)" &&
 	dir2=third/../second/other/.git &&
-	test "$dir" = "$(test-absolute-path $dir2)" &&
+	test "$dir" = "$(test-path-utils make_absolute_path $dir2)" &&
 	file="$dir"/index &&
-	test "$file" = "$(test-absolute-path $dir2/index)" &&
+	test "$file" = "$(test-path-utils make_absolute_path $dir2/index)" &&
 	basename=blub &&
-	test "$dir/$basename" = $(cd .git && test-absolute-path $basename) &&
+	test "$dir/$basename" = $(cd .git && test-path-utils make_absolute_path $basename) &&
 	ln -s ../first/file .git/syml &&
 	sym="$(cd first; pwd -P)"/file &&
-	test "$sym" = "$(test-absolute-path $dir2/syml)"
+	test "$sym" = "$(test-path-utils make_absolute_path $dir2/syml)"
 '
 
 test_expect_success 'very long name in the index handled sanely' '
test-absolute-path.c deleted +0 -11
deleted file mode 100644
index c959ea2..0000000
@@ -1,11 +0,0 @@
-#include "cache.h"
-
-int main(int argc, char **argv)
-{
-	while (argc > 1) {
-		puts(make_absolute_path(argv[1]));
-		argc--;
-		argv++;
-	}
-	return 0;
-}
test-path-utils.c +8 -0
index 1bd4321..842b580 100644
@@ -9,5 +9,13 @@ int main(int argc, char **argv)
 		puts(buf);
 	}
 
+	if (argc >= 2 && !strcmp(argv[1], "make_absolute_path")) {
+		while (argc > 2) {
+			puts(make_absolute_path(argv[2]));
+			argc--;
+			argv++;
+		}
+	}
+
 	return 0;
 }
Signature · 1 line
1.5.4