Checking the value of qmp_dispatch() is repetitive. Factor out
helpers do_qmp_dispatch() and do_qmp_dispatch_error(). Without this,
the next commit would make things even more repetitive.
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/test-qmp-cmds.c | 72 +++++++++++++++++++++----------------------
1 file changed, 35 insertions(+), 37 deletions(-)
+
+static void do_qmp_dispatch_error(QDict *req, bool allow_oob, ErrorClass cls)
+{
+ QDict *resp;
+
+ resp = qmp_dispatch(&qmp_commands, QOBJECT(req), allow_oob);
+ g_assert(resp && qdict_haskey(resp, "error"));
+
+ qobject_unref(resp);
+}