OSDN Git Service

tests/qapi-schema: Cover 'not' condition with empty argument
authorMarkus Armbruster <armbru@redhat.com>
Wed, 8 Sep 2021 04:54:27 +0000 (06:54 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 8 Sep 2021 13:30:10 +0000 (15:30 +0200)
We flag this, but the error message is bogus:

    bad-if-not.json:2: 'if' condition [] of struct is useless

The next commit will fix it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20210908045428.2689093-5-armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
tests/qapi-schema/bad-if-not.err [new file with mode: 0644]
tests/qapi-schema/bad-if-not.json [new file with mode: 0644]
tests/qapi-schema/bad-if-not.out [new file with mode: 0644]
tests/qapi-schema/meson.build

diff --git a/tests/qapi-schema/bad-if-not.err b/tests/qapi-schema/bad-if-not.err
new file mode 100644 (file)
index 0000000..b3acdd6
--- /dev/null
@@ -0,0 +1,2 @@
+bad-if-not.json: In struct 'TestIfStruct':
+bad-if-not.json:2: 'if' condition [] of struct is useless
diff --git a/tests/qapi-schema/bad-if-not.json b/tests/qapi-schema/bad-if-not.json
new file mode 100644 (file)
index 0000000..9fdaacc
--- /dev/null
@@ -0,0 +1,3 @@
+# check 'if not' with empy argument
+{ 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
+  'if': { 'not': '' } }
diff --git a/tests/qapi-schema/bad-if-not.out b/tests/qapi-schema/bad-if-not.out
new file mode 100644 (file)
index 0000000..e69de29
index 4697c07..6b2a4ce 100644 (file)
@@ -43,6 +43,7 @@ schemas = [
   'bad-if-key.json',
   'bad-if-keys.json',
   'bad-if-list.json',
+  'bad-if-not.json',
   'bad-type-bool.json',
   'bad-type-dict.json',
   'bad-type-int.json',