26ba25
From bd71f94946365ba320066bf166f7ce1789191521 Mon Sep 17 00:00:00 2001
26ba25
From: Markus Armbruster <armbru@redhat.com>
26ba25
Date: Mon, 18 Jun 2018 08:43:27 +0200
26ba25
Subject: [PATCH 029/268] check-block-qdict: Cover flattening of empty lists
26ba25
 and dictionaries
26ba25
26ba25
RH-Author: Markus Armbruster <armbru@redhat.com>
26ba25
Message-id: <20180618084330.30009-21-armbru@redhat.com>
26ba25
Patchwork-id: 80734
26ba25
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 20/23] check-block-qdict: Cover flattening of empty lists and dictionaries
26ba25
Bugzilla: 1557995
26ba25
RH-Acked-by: Max Reitz <mreitz@redhat.com>
26ba25
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
26ba25
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
26ba25
26ba25
Signed-off-by: Markus Armbruster <armbru@redhat.com>
26ba25
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
26ba25
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
26ba25
(cherry picked from commit bef96b1549907b005ce1fa1456d2a0910d2a1aa5)
26ba25
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
26ba25
---
26ba25
 tests/check-block-qdict.c | 14 +++++++++++++-
26ba25
 1 file changed, 13 insertions(+), 1 deletion(-)
26ba25
26ba25
diff --git a/tests/check-block-qdict.c b/tests/check-block-qdict.c
26ba25
index 29f58a2..2da16f0 100644
26ba25
--- a/tests/check-block-qdict.c
26ba25
+++ b/tests/check-block-qdict.c
26ba25
@@ -41,6 +41,8 @@ static void qdict_flatten_test(void)
26ba25
     QList *e = qlist_new();
26ba25
     QDict *e_1_2 = qdict_new();
26ba25
     QDict *f = qdict_new();
26ba25
+    QList *y = qlist_new();
26ba25
+    QDict *z = qdict_new();
26ba25
     QDict *root = qdict_new();
26ba25
 
26ba25
     /*
26ba25
@@ -62,7 +64,9 @@ static void qdict_flatten_test(void)
26ba25
      *         "c": 2,
26ba25
      *         "d": 3,
26ba25
      *     },
26ba25
-     *     "g": 4
26ba25
+     *     "g": 4,
26ba25
+     *     "y": [{}],
26ba25
+     *     "z": {"a": []}
26ba25
      * }
26ba25
      *
26ba25
      * to
26ba25
@@ -77,6 +81,8 @@ static void qdict_flatten_test(void)
26ba25
      *     "f.d": 3,
26ba25
      *     "g": 4
26ba25
      * }
26ba25
+     *
26ba25
+     * Note that "y" and "z" get eaten.
26ba25
      */
26ba25
 
26ba25
     qdict_put_int(e_1_2, "a", 0);
26ba25
@@ -91,9 +97,15 @@ static void qdict_flatten_test(void)
26ba25
     qdict_put_int(f, "c", 2);
26ba25
     qdict_put_int(f, "d", 3);
26ba25
 
26ba25
+    qlist_append(y, qdict_new());
26ba25
+
26ba25
+    qdict_put(z, "a", qlist_new());
26ba25
+
26ba25
     qdict_put(root, "e", e);
26ba25
     qdict_put(root, "f", f);
26ba25
     qdict_put_int(root, "g", 4);
26ba25
+    qdict_put(root, "y", y);
26ba25
+    qdict_put(root, "z", z);
26ba25
 
26ba25
     qdict_flatten(root);
26ba25
 
26ba25
-- 
26ba25
1.8.3.1
26ba25