aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-08-14 18:03:18 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-08-14 18:14:21 +0200
commitf545be725df9195a5b5897ad95a0220acf10f148 (patch)
treeb30aab92bcf23e94ca2c74fca0c6f5573d5745c2 /tests
parent7e8e085c97311b52db4d6739b6ef2a1b26a2319f (diff)
downloadliberty-f545be725df9195a5b5897ad95a0220acf10f148.tar.gz
liberty-f545be725df9195a5b5897ad95a0220acf10f148.tar.xz
liberty-f545be725df9195a5b5897ad95a0220acf10f148.zip
Extend string syntax in config
And actually test the results of string parsing.
Diffstat (limited to 'tests')
-rw-r--r--tests/liberty.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/liberty.c b/tests/liberty.c
index dc445d8..3d932d5 100644
--- a/tests/liberty.c
+++ b/tests/liberty.c
@@ -1,7 +1,7 @@
/*
* tests/liberty.c
*
- * Copyright (c) 2015 - 2016, Přemysl Eric Janouch <p@janouch.name>
+ * Copyright (c) 2015 - 2022, Přemysl Eric Janouch <p@janouch.name>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
@@ -649,7 +649,7 @@ static struct config_schema g_config_test[] =
.default_ = "1" },
{ .name = "foobar",
.type = CONFIG_ITEM_STRING,
- .default_ = "\"qux\\x01\"" },
+ .default_ = "\"qux\\x01`\" \"\"`a`" },
{}
};
@@ -675,6 +675,9 @@ test_config (void)
"top.bar", NULL), invalid, NULL));
config_item_destroy (invalid);
+ hard_assert (!strcmp ("qux\001`a",
+ config_item_get (config.root, "top.foobar", NULL)->value.string.str));
+
struct str s = str_make ();
config_item_write (config.root, true, &s);
struct config_item *parsed = config_item_parse (s.str, s.len, false, NULL);