aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-02-28 22:26:47 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-07 16:07:46 +0100
commit0e2052b26067f3c641b2418ef507160f54afcecf (patch)
tree4bacafa534f4dcc8225f1db39c160d8e80cb8dda
parentff79d5e939c38677a575e3493eb9b4d36eb21865 (diff)
test-qemu-opts: Cover qemu_opts_parse() of "no"
qemu_opts_parse() interprets "no" as negated empty key. Consistent with its acceptance of empty keys elsewhere, whatever that's worth. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <1488317230-26248-2-git-send-email-armbru@redhat.com>
-rw-r--r--tests/test-qemu-opts.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test-qemu-opts.c b/tests/test-qemu-opts.c
index c46ef31658..f6310b34f1 100644
--- a/tests/test-qemu-opts.c
+++ b/tests/test-qemu-opts.c
@@ -532,6 +532,11 @@ static void test_opts_parse(void)
g_assert_cmpstr(qemu_opt_get(opts, "aus"), ==, "off");
g_assert_cmpstr(qemu_opt_get(opts, "noaus"), ==, "");
+ /* Implied value, negated empty key */
+ opts = qemu_opts_parse(&opts_list_03, "no", false, &error_abort);
+ g_assert_cmpuint(opts_count(opts), ==, 1);
+ g_assert_cmpstr(qemu_opt_get(opts, ""), ==, "off");
+
/* Implied key */
opts = qemu_opts_parse(&opts_list_03, "an,noaus,noaus=", true,
&error_abort);