diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-08 07:51:39 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-09-09 13:49:30 -0400 |
commit | c9d954b27ee125c3c90a6d2951c62eec4abb160b (patch) | |
tree | 2a1e3a376ce997b95c5dfa41e50ca48bf2f347df /src/test/test-path-util.c | |
parent | 116cc028742836e61abce7582ec9ecf9f0aaeb53 (diff) |
run: allow non-absolute paths as command
Diffstat (limited to 'src/test/test-path-util.c')
-rw-r--r-- | src/test/test-path-util.c | 24 |
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; } |