diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-10-11 09:35:00 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2020-10-15 16:06:27 +0200 |
commit | ce40cbf11d215dc3f820bf32937f7e44aab4a1e3 (patch) | |
tree | 24e3275b1a5d55a749ef3906f0a05e19ef3cd954 /tests | |
parent | fec3331894a8a433d1a58ec2c929743bbf449cb1 (diff) |
test-keyval: Demonstrate misparse of ',' with implied key
Add a test for "val,,ue" with implied key. Documentation says this
should parse as implied key with value "val", then fail. The code
parses it as implied key with value "val,ue", then succeeds. The next
commit will fix it.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20201011073505.1185335-3-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-keyval.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test-keyval.c b/tests/test-keyval.c index e331a84149..f02bdf7029 100644 --- a/tests/test-keyval.c +++ b/tests/test-keyval.c @@ -182,6 +182,13 @@ static void test_keyval_parse(void) error_free_or_abort(&err); g_assert(!qdict); + /* Implied key's value can't have comma (qemu_opts_parse(): it can) */ + /* BUG: it can */ + qdict = keyval_parse("val,,ue", "implied", &error_abort); + g_assert_cmpuint(qdict_size(qdict), ==, 1); + g_assert_cmpstr(qdict_get_try_str(qdict, "implied"), ==, "val,ue"); + qobject_unref(qdict); + /* Empty key is not an implied key */ qdict = keyval_parse("=val", "implied", &err); error_free_or_abort(&err); |