diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-03-20 17:13:43 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-03-21 10:43:01 +0100 |
commit | d2788227c6185c72d88ef3127e9fed41686f8e39 (patch) | |
tree | 35e49cc56a1dffceeb9c341a9852df2b2fbe0c53 /tests/test-string-input-visitor.c | |
parent | c32617a1941aadfe580af6c4418ef02c9644cd44 (diff) |
qapi: Fix string input visitor regression for empty lists
Visiting a list when input is the empty string should result in an
empty list, not an error. Noticed when commit 3d089ce belatedly added
tests, but simply accepted as weird then. It's actually a regression:
broken in commit 74f24cb, v2.7.0. Fix it, and throw in another test
case for empty string.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1490026424-11330-2-git-send-email-armbru@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/test-string-input-visitor.c')
-rw-r--r-- | tests/test-string-input-visitor.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c index 6db850bc89..79313a7f7a 100644 --- a/tests/test-string-input-visitor.c +++ b/tests/test-string-input-visitor.c @@ -63,6 +63,11 @@ static void test_visitor_in_int(TestInputVisitorData *data, visit_type_int(v, NULL, &res, &err); error_free_or_abort(&err); + + v = visitor_input_test_init(data, ""); + + visit_type_int(v, NULL, &res, &err); + error_free_or_abort(&err); } static void check_ilist(Visitor *v, int64_t *expected, size_t n) @@ -140,11 +145,11 @@ static void test_visitor_in_intList(TestInputVisitorData *data, v = visitor_input_test_init(data, "18446744073709551615"); check_ulist(v, expect4, ARRAY_SIZE(expect4)); - /* Empty list is invalid (weird) */ + /* Empty list */ v = visitor_input_test_init(data, ""); - visit_type_int64List(v, NULL, &res, &err); - error_free_or_abort(&err); + visit_type_int64List(v, NULL, &res, &error_abort); + g_assert(!res); /* Not a list */ |