aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qobject-input-visitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-06-26 18:22:59 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-07-24 13:35:11 +0200
commitd2f95f4d482374485234790a6fc3cca29ebb7355 (patch)
tree4c95230bc64d9a294c9bc6de6696e887576a235a /tests/test-qobject-input-visitor.c
parent006ca09f3027d86346fce707e9295975c6558f42 (diff)
qapi: Use QNull for a more regular visit_type_null()
Make visit_type_null() take an @obj argument like its buddies. This helps keep the next commit simple. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'tests/test-qobject-input-visitor.c')
-rw-r--r--tests/test-qobject-input-visitor.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 34bab8a913..f98caf9818 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -510,6 +510,7 @@ static void test_visitor_in_null(TestInputVisitorData *data,
{
Visitor *v;
Error *err = NULL;
+ QNull *null;
char *tmp;
/*
@@ -524,12 +525,15 @@ static void test_visitor_in_null(TestInputVisitorData *data,
v = visitor_input_test_init_full(data, false,
"{ 'a': null, 'b': '' }");
visit_start_struct(v, NULL, NULL, 0, &error_abort);
- visit_type_null(v, "a", &error_abort);
- visit_type_null(v, "b", &err);
+ visit_type_null(v, "a", &null, &error_abort);
+ g_assert(qobject_type(QOBJECT(null)) == QTYPE_QNULL);
+ QDECREF(null);
+ visit_type_null(v, "b", &null, &err);
error_free_or_abort(&err);
+ g_assert(!null);
visit_type_str(v, "c", &tmp, &err);
- g_assert(!tmp);
error_free_or_abort(&err);
+ g_assert(!tmp);
visit_check_struct(v, &error_abort);
visit_end_struct(v, NULL);
}
@@ -1087,6 +1091,7 @@ static void test_visitor_in_fail_struct_missing(TestInputVisitorData *data,
Error *err = NULL;
Visitor *v;
QObject *any;
+ QNull *null;
GenericAlternate *alt;
bool present;
int en;
@@ -1120,7 +1125,7 @@ static void test_visitor_in_fail_struct_missing(TestInputVisitorData *data,
error_free_or_abort(&err);
visit_type_any(v, "any", &any, &err);
error_free_or_abort(&err);
- visit_type_null(v, "null", &err);
+ visit_type_null(v, "null", &null, &err);
error_free_or_abort(&err);
visit_start_list(v, "sub", NULL, 0, &error_abort);
visit_start_struct(v, NULL, NULL, 0, &error_abort);