summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-06-25 20:16:15 +0200
committerLennart Poettering <lennart@poettering.net>2012-06-25 20:16:15 +0200
commit35eb6b124ebdf82bd77aad6e44962a9a039c4d33 (patch)
tree95f6283713ae0d47a7ff896c188c49fdb28cb52c /src/test
parent61beaf818bd222fdbacd233fba8df6124ec8d32d (diff)
cryptsetup: fix escaping when generating cryptsetup units
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-unit-name.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c
index 9d636afe15..392e358ac2 100644
--- a/src/test/test-unit-name.c
+++ b/src/test/test-unit-name.c
@@ -29,6 +29,57 @@
int main(int argc, char* argv[]) {
char *t, *k;
+ t = unit_name_from_path("/waldo", ".mount");
+ puts(t);
+ k = unit_name_to_path(t);
+ puts(k);
+ free(k);
+ free(t);
+
+ t = unit_name_from_path("/waldo/quuix", ".mount");
+ puts(t);
+ k = unit_name_to_path(t);
+ puts(k);
+ free(k);
+ free(t);
+
+ t = unit_name_from_path("/waldo/quuix/", ".mount");
+ puts(t);
+ k = unit_name_to_path(t);
+ puts(k);
+ free(k);
+ free(t);
+
+ t = unit_name_from_path("/", ".mount");
+ puts(t);
+ k = unit_name_to_path(t);
+ puts(k);
+ free(k);
+ free(t);
+
+ t = unit_name_from_path("///", ".mount");
+ puts(t);
+ k = unit_name_to_path(t);
+ puts(k);
+ free(k);
+ free(t);
+
+ t = unit_name_from_path_instance("waldo", "/waldo", ".mount");
+ puts(t);
+ free(t);
+
+ t = unit_name_from_path_instance("waldo", "/waldo////quuix////", ".mount");
+ puts(t);
+ free(t);
+
+ t = unit_name_from_path_instance("waldo", "/", ".mount");
+ puts(t);
+ free(t);
+
+ t = unit_name_from_path_instance("wa--ldo", "/--", ".mount");
+ puts(t);
+ free(t);
+
assert_se(t = unit_name_mangle("/home"));
assert_se(k = unit_name_mangle(t));
puts(t);