Extend string syntax in config
And actually test the results of string parsing.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user