summaryrefslogtreecommitdiff
path: root/src/test/test-path-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-path-util.c')
-rw-r--r--src/test/test-path-util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
index f396b32ffe..b0aeb11a63 100644
--- a/src/test/test-path-util.c
+++ b/src/test/test-path-util.c
@@ -83,7 +83,31 @@ static void test_path(void) {
}
}
+static void test_find_binary(void) {
+ char *p;
+
+ assert(find_binary("/bin/sh", &p) == 0);
+ puts(p);
+ assert(streq(p, "/bin/sh"));
+ free(p);
+
+ assert(find_binary("./test-path-util", &p) == 0);
+ puts(p);
+ assert(endswith(p, "/test-path-util"));
+ assert(path_is_absolute(p));
+ free(p);
+
+ assert(find_binary("sh", &p) == 0);
+ puts(p);
+ assert(endswith(p, "/sh"));
+ assert(path_is_absolute(p));
+ free(p);
+
+ assert(find_binary("xxxx-xxxx", &p) == -ENOENT);
+}
+
int main(void) {
test_path();
+ test_find_binary();
return 0;
}