summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-path-util.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/test-path-util.c b/src/test/test-path-util.c
index f7e96283f..e7a247027 100644
--- a/src/test/test-path-util.c
+++ b/src/test/test-path-util.c
@@ -478,6 +478,19 @@ static void test_skip_dev_prefix(void) {
assert_se(streq(skip_dev_prefix("foo"), "foo"));
}
+static void test_empty_or_root(void) {
+ assert_se(empty_or_root(NULL));
+ assert_se(empty_or_root(""));
+ assert_se(empty_or_root("/"));
+ assert_se(empty_or_root("//"));
+ assert_se(empty_or_root("///"));
+ assert_se(empty_or_root("/////////////////"));
+ assert_se(!empty_or_root("xxx"));
+ assert_se(!empty_or_root("/xxx"));
+ assert_se(!empty_or_root("/xxx/"));
+ assert_se(!empty_or_root("//yy//"));
+}
+
int main(int argc, char **argv) {
log_set_max_level(LOG_DEBUG);
log_parse_environment();
@@ -500,6 +513,7 @@ int main(int argc, char **argv) {
test_filename_is_valid();
test_hidden_or_backup_file();
test_skip_dev_prefix();
+ test_empty_or_root();
#if 0 /// UNNEEDED by elogind
test_systemd_installation_has_version(argv[1]); /* NULL is OK */