diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2021-08-04 12:31:04 +0400 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2021-08-26 13:53:56 +0200 |
commit | 2b7d2145369f2ca55ded9045393bb860ee3f6745 (patch) | |
tree | bd4bb8b19ac3c6986202674717fefbef813c67a2 /tests/qapi-schema | |
parent | 8a156d89d15ec190ff519e7ecaaa0b85e1ff4a7b (diff) |
qapi: add 'not' condition operation
For the sake of completeness, introduce the 'not' condition.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210804083105.97531-10-marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
[Long line broken in tests/qapi-schema/qapi-schema-test.json]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/qapi-schema')
-rw-r--r-- | tests/qapi-schema/bad-if-key.err | 2 | ||||
-rw-r--r-- | tests/qapi-schema/bad-if-keys.err | 2 | ||||
-rw-r--r-- | tests/qapi-schema/doc-good.json | 3 | ||||
-rw-r--r-- | tests/qapi-schema/doc-good.out | 1 | ||||
-rw-r--r-- | tests/qapi-schema/doc-good.txt | 6 | ||||
-rw-r--r-- | tests/qapi-schema/enum-if-invalid.err | 2 | ||||
-rw-r--r-- | tests/qapi-schema/qapi-schema-test.json | 3 | ||||
-rw-r--r-- | tests/qapi-schema/qapi-schema-test.out | 4 |
8 files changed, 16 insertions, 7 deletions
diff --git a/tests/qapi-schema/bad-if-key.err b/tests/qapi-schema/bad-if-key.err index 7236f46e7a..a69dc9ee86 100644 --- a/tests/qapi-schema/bad-if-key.err +++ b/tests/qapi-schema/bad-if-key.err @@ -1,3 +1,3 @@ bad-if-key.json: In struct 'TestIfStruct': bad-if-key.json:2: 'if' condition has unknown key 'value' -Valid keys are 'all', 'any'. +Valid keys are 'all', 'any', 'not'. diff --git a/tests/qapi-schema/bad-if-keys.err b/tests/qapi-schema/bad-if-keys.err index db6d019d77..aceb31dc6d 100644 --- a/tests/qapi-schema/bad-if-keys.err +++ b/tests/qapi-schema/bad-if-keys.err @@ -1,2 +1,2 @@ bad-if-keys.json: In struct 'TestIfStruct': -bad-if-keys.json:2: 'if' condition dict of struct must have one key: 'all' or 'any' +bad-if-keys.json:2: 'if' condition dict of struct must have one key: 'all', 'any' or 'not' diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json index e253d89ee0..2a35c679a4 100644 --- a/tests/qapi-schema/doc-good.json +++ b/tests/qapi-schema/doc-good.json @@ -126,7 +126,8 @@ ## { 'alternate': 'Alternate', 'features': [ 'alt-feat' ], - 'data': { 'i': 'int', 'b': 'bool' } } + 'data': { 'i': 'int', 'b': 'bool' }, + 'if': { 'not': 'IFNOT' } } ## # == Another subsection diff --git a/tests/qapi-schema/doc-good.out b/tests/qapi-schema/doc-good.out index c44c346ec8..a8871e8f99 100644 --- a/tests/qapi-schema/doc-good.out +++ b/tests/qapi-schema/doc-good.out @@ -51,6 +51,7 @@ alternate Alternate tag type case i: int case b: bool + if OrderedDict([('not', 'IFNOT')]) feature alt-feat object q_obj_cmd-arg member arg1: int optional=False diff --git a/tests/qapi-schema/doc-good.txt b/tests/qapi-schema/doc-good.txt index 251e9b746c..03c98c4182 100644 --- a/tests/qapi-schema/doc-good.txt +++ b/tests/qapi-schema/doc-good.txt @@ -171,6 +171,12 @@ Features a feature +If +~~ + +"!IFNOT" + + Another subsection ================== diff --git a/tests/qapi-schema/enum-if-invalid.err b/tests/qapi-schema/enum-if-invalid.err index b96d94c48a..3bb84075a9 100644 --- a/tests/qapi-schema/enum-if-invalid.err +++ b/tests/qapi-schema/enum-if-invalid.err @@ -1,3 +1,3 @@ enum-if-invalid.json: In enum 'TestIfEnum': enum-if-invalid.json:2: 'if' condition has unknown key 'val' -Valid keys are 'all', 'any'. +Valid keys are 'all', 'any', 'not'. diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index 7737b32de8..a700f2531b 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -245,7 +245,8 @@ { 'command': 'test-if-alternate-cmd', 'data': { 'alt-cmd-arg': 'TestIfAlternate' }, - 'if': { 'all': ['defined(TEST_IF_ALT)'] } } + 'if': { 'all': ['defined(TEST_IF_ALT)', + {'not': 'defined(TEST_IF_NOT_ALT)'}] } } { 'command': 'test-if-cmd', 'data': { diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out index 2f067d57af..53e12f3534 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -333,10 +333,10 @@ alternate TestIfAlternate if OrderedDict([('all', ['defined(TEST_IF_ALT)', 'defined(TEST_IF_STRUCT)'])]) object q_obj_test-if-alternate-cmd-arg member alt-cmd-arg: TestIfAlternate optional=False - if OrderedDict([('all', ['defined(TEST_IF_ALT)'])]) + if OrderedDict([('all', ['defined(TEST_IF_ALT)', OrderedDict([('not', 'defined(TEST_IF_NOT_ALT)')])])]) command test-if-alternate-cmd q_obj_test-if-alternate-cmd-arg -> None gen=True success_response=True boxed=False oob=False preconfig=False - if OrderedDict([('all', ['defined(TEST_IF_ALT)'])]) + if OrderedDict([('all', ['defined(TEST_IF_ALT)', OrderedDict([('not', 'defined(TEST_IF_NOT_ALT)')])])]) object q_obj_test-if-cmd-arg member foo: TestIfStruct optional=False member bar: TestIfEnum optional=False |