diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-02-17 21:38:14 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-02-22 19:51:51 +0100 |
commit | a68931ea5f87ee3cc3144348596077de87f94c93 (patch) | |
tree | c838d05faba0d97c47dbd397a6fa1dc9ff06fb8a /tests/check-qdict.c | |
parent | ff9d38963e55598b40237735426225c35de6c7e5 (diff) |
check-qdict: Tighten qdict_crumple_test_recursive() some
Consistently check for unexpected QDict entries, and qdict_get_qdict()
success. The latter doesn't tighten the test, it only makes it fail
more nicely.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1487363905-9480-4-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/check-qdict.c')
-rw-r--r-- | tests/check-qdict.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/check-qdict.c b/tests/check-qdict.c index 14e942aaba..ded3a264e1 100644 --- a/tests/check-qdict.c +++ b/tests/check-qdict.c @@ -615,26 +615,31 @@ static void qdict_crumple_test_recursive(void) vnc = qdict_get_qdict(dst, "vnc"); g_assert(vnc); + g_assert_cmpint(qdict_size(vnc), ==, 3); listen = qdict_get_qdict(vnc, "listen"); g_assert(listen); + g_assert_cmpint(qdict_size(listen), ==, 2); g_assert_cmpstr("127.0.0.1", ==, qdict_get_str(listen, "addr")); g_assert_cmpstr("5901", ==, qdict_get_str(listen, "port")); acl = qdict_get_qdict(vnc, "acl"); g_assert(acl); + g_assert_cmpint(qdict_size(acl), ==, 3); rules = qdict_get_qlist(acl, "rules"); g_assert(rules); g_assert_cmpint(qlist_size(rules), ==, 2); rule = qobject_to_qdict(qlist_pop(rules)); + g_assert(rule); g_assert_cmpint(qdict_size(rule), ==, 2); g_assert_cmpstr("fred", ==, qdict_get_str(rule, "match")); g_assert_cmpstr("allow", ==, qdict_get_str(rule, "policy")); QDECREF(rule); rule = qobject_to_qdict(qlist_pop(rules)); + g_assert(rule); g_assert_cmpint(qdict_size(rule), ==, 2); g_assert_cmpstr("bob", ==, qdict_get_str(rule, "match")); g_assert_cmpstr("deny", ==, qdict_get_str(rule, "policy")); |