summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-07-31 19:40:57 +0200
committerDaniel Mack <github@zonque.org>2015-07-31 19:40:57 +0200
commitc474a4ecfa74d90d02822d24efa310197a5c3298 (patch)
treeb03788434fd764ac3fc5a8cd8edd45c1e92a223e /src/test
parent6ba32d1c2f04f3f01cea6ba1a082028412b5c474 (diff)
parentcbfa6a41317b72553433f4ebe250dd0d34bf058f (diff)
Merge pull request #811 from namhyung/busctl-misc-v2
busctl: Misc cleanups and a fix (v2)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-util.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c
index f43433baa1..7a1a4b6df2 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -2083,6 +2083,18 @@ static void test_tempfn(void) {
free(ret);
}
+static void test_strcmp_ptr(void) {
+ assert_se(strcmp_ptr(NULL, NULL) == 0);
+ assert_se(strcmp_ptr("", NULL) > 0);
+ assert_se(strcmp_ptr("foo", NULL) > 0);
+ assert_se(strcmp_ptr(NULL, "") < 0);
+ assert_se(strcmp_ptr(NULL, "bar") < 0);
+ assert_se(strcmp_ptr("foo", "bar") > 0);
+ assert_se(strcmp_ptr("bar", "baz") < 0);
+ assert_se(strcmp_ptr("foo", "foo") == 0);
+ assert_se(strcmp_ptr("", "") == 0);
+}
+
int main(int argc, char *argv[]) {
log_parse_environment();
log_open();
@@ -2169,6 +2181,7 @@ int main(int argc, char *argv[]) {
test_shell_maybe_quote();
test_parse_mode();
test_tempfn();
+ test_strcmp_ptr();
return 0;
}