X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=test-path-utils.c;h=d261398d6c50aeefa7450b99caae23ee5cdff0d0;hb=df3dac3758e0b3e8178aff03fd0ceaf340735527;hp=7e6fc8deaf859e07b268f0fad2dc2e80bc139a34;hpb=2cd85c40a9f396bb24f7861c832acd52e61c4780;p=git.git diff --git a/test-path-utils.c b/test-path-utils.c index 7e6fc8dea..d261398d6 100644 --- a/test-path-utils.c +++ b/test-path-utils.c @@ -2,10 +2,11 @@ int main(int argc, char **argv) { - if (argc == 3 && !strcmp(argv[1], "normalize_absolute_path")) { + if (argc == 3 && !strcmp(argv[1], "normalize_path_copy")) { char *buf = xmalloc(PATH_MAX + 1); - int rv = normalize_absolute_path(buf, argv[2]); - assert(strlen(buf) == rv); + int rv = normalize_path_copy(buf, argv[2]); + if (rv) + buf = "++failed++"; puts(buf); return 0; } @@ -25,6 +26,12 @@ int main(int argc, char **argv) return 0; } + if (argc == 4 && !strcmp(argv[1], "strip_path_suffix")) { + char *prefix = strip_path_suffix(argv[2], argv[3]); + printf("%s\n", prefix ? prefix : "(null)"); + return 0; + } + fprintf(stderr, "%s: unknown function name: %s\n", argv[0], argv[1] ? argv[1] : "(there was none)"); return 1;