diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-util.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c index dd7768d36c..ad13d53de3 100644 --- a/src/test/test-util.c +++ b/src/test/test-util.c @@ -547,6 +547,41 @@ static void test_split_pair(void) { assert_se(streq(b, "=")); } +static void test_fstab_node_to_udev_node(void) { + char *n; + + n = fstab_node_to_udev_node("LABEL=applé/jack"); + puts(n); + assert_se(streq(n, "/dev/disk/by-label/applé\\x2fjack")); + free(n); + + n = fstab_node_to_udev_node("PARTLABEL=pinkié pie"); + puts(n); + assert_se(streq(n, "/dev/disk/by-partlabel/pinkié\\x20pie")); + free(n); + + n = fstab_node_to_udev_node("UUID=037b9d94-148e-4ee4-8d38-67bfe15bb535"); + puts(n); + assert_se(streq(n, "/dev/disk/by-uuid/037b9d94-148e-4ee4-8d38-67bfe15bb535")); + free(n); + + n = fstab_node_to_udev_node("PARTUUID=037b9d94-148e-4ee4-8d38-67bfe15bb535"); + puts(n); + assert_se(streq(n, "/dev/disk/by-partuuid/037b9d94-148e-4ee4-8d38-67bfe15bb535")); + free(n); + + + n = fstab_node_to_udev_node("PONIES=awesome"); + puts(n); + assert_se(streq(n, "PONIES=awesome")); + free(n); + + n = fstab_node_to_udev_node("/dev/xda1"); + puts(n); + assert_se(streq(n, "/dev/xda1")); + free(n); +} + int main(int argc, char *argv[]) { test_streq_ptr(); test_first_word(); @@ -582,6 +617,7 @@ int main(int argc, char *argv[]) { test_strrep(); test_parse_user_at_host(); test_split_pair(); + test_fstab_node_to_udev_node(); return 0; } |