diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-11 23:20:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-11 23:20:54 +0200 |
commit | 92e189e57297b110a1a12703aa17557e3600cf4f (patch) | |
tree | 602945bacbc479afeb7f9b8d21728da074c82a8d /src/libsystemd-bus/test-bus-signature.c | |
parent | 8e4e652b92c8c2f640f8ac1c839dd4a0fd11f3c4 (diff) |
bus: unify code to find parents of an object path with
Diffstat (limited to 'src/libsystemd-bus/test-bus-signature.c')
-rw-r--r-- | src/libsystemd-bus/test-bus-signature.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libsystemd-bus/test-bus-signature.c b/src/libsystemd-bus/test-bus-signature.c index c4304697f0..3fc565c620 100644 --- a/src/libsystemd-bus/test-bus-signature.c +++ b/src/libsystemd-bus/test-bus-signature.c @@ -27,6 +27,8 @@ #include "bus-internal.h" int main(int argc, char *argv[]) { + char prefix[256]; + int r; assert_se(signature_is_single("y", false)); assert_se(signature_is_single("u", false)); @@ -133,5 +135,29 @@ int main(int argc, char *argv[]) { assert_se(!object_path_is_valid("/foo//bar")); assert_se(!object_path_is_valid("/foo/aaaäöä")); + OBJECT_PATH_FOREACH_PREFIX(prefix, "/") { + log_info("<%s>", prefix); + assert_not_reached("???"); + } + + r = 0; + OBJECT_PATH_FOREACH_PREFIX(prefix, "/xxx") { + log_info("<%s>", prefix); + assert_se(streq(prefix, "/")); + assert_se(r == 0); + r++; + } + assert_se(r == 1); + + r = 0; + OBJECT_PATH_FOREACH_PREFIX(prefix, "/xxx/yyy/zzz") { + log_info("<%s>", prefix); + assert_se(r != 0 || streq(prefix, "/xxx/yyy")); + assert_se(r != 1 || streq(prefix, "/xxx")); + assert_se(r != 2 || streq(prefix, "/")); + r++; + } + assert_se(r == 3); + return 0; } |