diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-06-20 16:18:37 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-01-03 18:38:46 +0100 |
commit | cc03788086e4c02d8e1f44cc84e0536594cca230 (patch) | |
tree | 89427889b86ded03fa2af8f40653d471c9da5150 /src/test/test-stat-util.c | |
parent | string-util: add strrstr() helper (diff) | |
download | systemd-cc03788086e4c02d8e1f44cc84e0536594cca230.tar.xz systemd-cc03788086e4c02d8e1f44cc84e0536594cca230.zip |
stat-util: add inode_type_from_string() helper
Diffstat (limited to '')
-rw-r--r-- | src/test/test-stat-util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/test-stat-util.c b/src/test/test-stat-util.c index 5aca207fa4..95137ffcf1 100644 --- a/src/test/test-stat-util.c +++ b/src/test/test-stat-util.c @@ -180,6 +180,21 @@ TEST(dir_is_empty) { assert_se(dir_is_empty_at(AT_FDCWD, empty_dir, /* ignore_hidden_or_backup= */ false) > 0); } +TEST(inode_type_from_string) { + static const mode_t types[] = { + S_IFREG, + S_IFDIR, + S_IFLNK, + S_IFCHR, + S_IFBLK, + S_IFIFO, + S_IFSOCK, + }; + + FOREACH_ARRAY(m, types, ELEMENTSOF(types)) + assert_se(inode_type_from_string(inode_type_to_string(*m)) == *m); +} + static int intro(void) { log_show_color(true); return EXIT_SUCCESS; |