diff options
Diffstat (limited to 'tests/qapi-schema')
23 files changed, 54 insertions, 3 deletions
diff --git a/tests/qapi-schema/enum-union-clash.err b/tests/qapi-schema/enum-union-clash.err deleted file mode 100644 index c04e1a8..0000000 --- a/tests/qapi-schema/enum-union-clash.err +++ /dev/null @@ -1 +0,0 @@ -tests/qapi-schema/enum-union-clash.json:2: enum 'UnionKind' should not end in 'Kind' diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index 4e2d7c2..48e104b 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -11,6 +11,10 @@ # An empty enum, although unusual, is currently acceptable { 'enum': 'MyEnum', 'data': [ ] } +# Likewise for an empty struct, including an empty base +{ 'struct': 'Empty1', 'data': { } } +{ 'struct': 'Empty2', 'base': 'Empty1', 'data': { } } + # for testing override of default naming heuristic { 'enum': 'QEnumTwo', 'prefix': 'QENUM_TWO', diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out index a6c80e0..a7e9aab 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -81,6 +81,9 @@ event EVENT_A None event EVENT_B None event EVENT_C :obj-EVENT_C-arg event EVENT_D :obj-EVENT_D-arg +object Empty1 +object Empty2 + base Empty1 enum EnumOne ['value1', 'value2', 'value3'] object EventStructOne member struct1: UserDefOne optional=False diff --git a/tests/qapi-schema/enum-union-clash.out b/tests/qapi-schema/reserved-command-q.err index e69de29..e69de29 100644 --- a/tests/qapi-schema/enum-union-clash.out +++ b/tests/qapi-schema/reserved-command-q.err diff --git a/tests/qapi-schema/reserved-command-q.exit b/tests/qapi-schema/reserved-command-q.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/reserved-command-q.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/reserved-command-q.json b/tests/qapi-schema/reserved-command-q.json new file mode 100644 index 0000000..be9944c --- /dev/null +++ b/tests/qapi-schema/reserved-command-q.json @@ -0,0 +1,7 @@ +# C entity name collision +# FIXME - This parses, but fails to compile, because it attempts to declare +# two 'qmp_q_unix' functions (one for 'q-unix', the other because c_name() +# munges 'unix' to 'q_unix' to avoid reserved word collisions). We should +# reject attempts to explicitly use 'q_' names, to reserve it for qapi. +{ 'command': 'unix' } +{ 'command': 'q-unix' } diff --git a/tests/qapi-schema/reserved-command-q.out b/tests/qapi-schema/reserved-command-q.out new file mode 100644 index 0000000..b31b38f --- /dev/null +++ b/tests/qapi-schema/reserved-command-q.out @@ -0,0 +1,5 @@ +object :empty +command q-unix None -> None + gen=True success_response=True +command unix None -> None + gen=True success_response=True diff --git a/tests/qapi-schema/reserved-member-has.err b/tests/qapi-schema/reserved-member-has.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/qapi-schema/reserved-member-has.err diff --git a/tests/qapi-schema/reserved-member-has.exit b/tests/qapi-schema/reserved-member-has.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/reserved-member-has.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/reserved-member-has.json b/tests/qapi-schema/reserved-member-has.json new file mode 100644 index 0000000..a2197de --- /dev/null +++ b/tests/qapi-schema/reserved-member-has.json @@ -0,0 +1,6 @@ +# C member name collision +# FIXME - This parses, but fails to compile, because the C struct is given +# two 'has_a' members, one from the flag for optional 'a', and the other +# from member 'has-a'. Either reject this at parse time, or munge the C +# names to avoid the collision. +{ 'command': 'oops', 'data': { '*a': 'str', 'has-a': 'str' } } diff --git a/tests/qapi-schema/reserved-member-has.out b/tests/qapi-schema/reserved-member-has.out new file mode 100644 index 0000000..5a18b6b --- /dev/null +++ b/tests/qapi-schema/reserved-member-has.out @@ -0,0 +1,6 @@ +object :empty +object :obj-oops-arg + member a: str optional=True + member has-a: str optional=False +command oops :obj-oops-arg -> None + gen=True success_response=True diff --git a/tests/qapi-schema/reserved-member-q.err b/tests/qapi-schema/reserved-member-q.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/qapi-schema/reserved-member-q.err diff --git a/tests/qapi-schema/reserved-member-q.exit b/tests/qapi-schema/reserved-member-q.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/reserved-member-q.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/reserved-member-q.json b/tests/qapi-schema/reserved-member-q.json new file mode 100644 index 0000000..1602ed3 --- /dev/null +++ b/tests/qapi-schema/reserved-member-q.json @@ -0,0 +1,6 @@ +# C member name collision +# FIXME - This parses, but fails to compile, because it attempts to declare +# two 'q_unix' members (one for 'q-unix', the other because c_name() +# munges 'unix' to 'q_unix' to avoid reserved word collisions). We should +# reject attempts to explicitly use 'q_' names, to reserve it for qapi. +{ 'struct': 'Foo', 'data': { 'unix':'int', 'q-unix':'bool' } } diff --git a/tests/qapi-schema/reserved-member-q.out b/tests/qapi-schema/reserved-member-q.out new file mode 100644 index 0000000..0d8685a --- /dev/null +++ b/tests/qapi-schema/reserved-member-q.out @@ -0,0 +1,4 @@ +object :empty +object Foo + member unix: int optional=False + member q-unix: bool optional=False diff --git a/tests/qapi-schema/reserved-type-kind.err b/tests/qapi-schema/reserved-type-kind.err new file mode 100644 index 0000000..0a38efa --- /dev/null +++ b/tests/qapi-schema/reserved-type-kind.err @@ -0,0 +1 @@ +tests/qapi-schema/reserved-type-kind.json:2: enum 'UnionKind' should not end in 'Kind' diff --git a/tests/qapi-schema/enum-union-clash.exit b/tests/qapi-schema/reserved-type-kind.exit index d00491f..d00491f 100644 --- a/tests/qapi-schema/enum-union-clash.exit +++ b/tests/qapi-schema/reserved-type-kind.exit diff --git a/tests/qapi-schema/enum-union-clash.json b/tests/qapi-schema/reserved-type-kind.json index 593282b..9ecaba1 100644 --- a/tests/qapi-schema/enum-union-clash.json +++ b/tests/qapi-schema/reserved-type-kind.json @@ -1,4 +1,2 @@ # we reject types that would conflict with implicit union enum { 'enum': 'UnionKind', 'data': [ 'oops' ] } -{ 'union': 'Union', - 'data': { 'a': 'int' } } diff --git a/tests/qapi-schema/reserved-type-kind.out b/tests/qapi-schema/reserved-type-kind.out new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/qapi-schema/reserved-type-kind.out diff --git a/tests/qapi-schema/reserved-type-list.err b/tests/qapi-schema/reserved-type-list.err new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/qapi-schema/reserved-type-list.err diff --git a/tests/qapi-schema/reserved-type-list.exit b/tests/qapi-schema/reserved-type-list.exit new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/qapi-schema/reserved-type-list.exit @@ -0,0 +1 @@ +0 diff --git a/tests/qapi-schema/reserved-type-list.json b/tests/qapi-schema/reserved-type-list.json new file mode 100644 index 0000000..5b7d0f9 --- /dev/null +++ b/tests/qapi-schema/reserved-type-list.json @@ -0,0 +1,5 @@ +# Potential C name collision +# FIXME - This parses and compiles on its own, but prevents the user from +# creating a type named 'Foo' and using ['Foo'] for an array. We should +# reject the use of any type names ending in 'List'. +{ 'struct': 'FooList', 'data': { 's': 'str' } } diff --git a/tests/qapi-schema/reserved-type-list.out b/tests/qapi-schema/reserved-type-list.out new file mode 100644 index 0000000..0406bfe --- /dev/null +++ b/tests/qapi-schema/reserved-type-list.out @@ -0,0 +1,3 @@ +object :empty +object FooList + member s: str optional=False |