diff mbox

[v3,05/14] qapi: add some expr tests

Message ID 1407287673-20308-6-git-send-email-eblake@redhat.com
State New
Headers show

Commit Message

Eric Blake Aug. 6, 2014, 1:14 a.m. UTC
Demonstrate that the qapi generator doesn't deal well with
expressions that aren't up to par. Later patches will improve
the expected results as the generator is made stricter.

* tests/qapi-schema/missing-type.*: New files.
* tests/qapi-schema/double-type.*: Likewise.
* tests/Makefile (check-qapi-schema-y): Run them.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 tests/Makefile                      | 1 +
 tests/qapi-schema/double-type.err   | 0
 tests/qapi-schema/double-type.exit  | 1 +
 tests/qapi-schema/double-type.json  | 1 +
 tests/qapi-schema/double-type.out   | 3 +++
 tests/qapi-schema/missing-type.err  | 0
 tests/qapi-schema/missing-type.exit | 1 +
 tests/qapi-schema/missing-type.json | 1 +
 tests/qapi-schema/missing-type.out  | 3 +++
 9 files changed, 11 insertions(+)
 create mode 100644 tests/qapi-schema/double-type.err
 create mode 100644 tests/qapi-schema/double-type.exit
 create mode 100644 tests/qapi-schema/double-type.json
 create mode 100644 tests/qapi-schema/double-type.out
 create mode 100644 tests/qapi-schema/missing-type.err
 create mode 100644 tests/qapi-schema/missing-type.exit
 create mode 100644 tests/qapi-schema/missing-type.json
 create mode 100644 tests/qapi-schema/missing-type.out
diff mbox

Patch

diff --git a/tests/Makefile b/tests/Makefile
index fbf6909..1b0c96f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -192,6 +192,7 @@  $(foreach target,$(SYSEMU_TARGET_LIST), \
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
 	comments.json empty.json enum-empty.json enum-missing-data.json \
 	enum-wrong-data.json funny-char.json indented-expr.json \
+	missing-type.json double-type.json \
 	missing-colon.json missing-comma-list.json \
 	missing-comma-object.json non-objects.json \
 	qapi-schema-test.json quoted-structural-chars.json \
diff --git a/tests/qapi-schema/double-type.err b/tests/qapi-schema/double-type.err
new file mode 100644
index 0000000..e69de29
diff --git a/tests/qapi-schema/double-type.exit b/tests/qapi-schema/double-type.exit
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/qapi-schema/double-type.exit
@@ -0,0 +1 @@ 
+0
diff --git a/tests/qapi-schema/double-type.json b/tests/qapi-schema/double-type.json
new file mode 100644
index 0000000..2d4d97d
--- /dev/null
+++ b/tests/qapi-schema/double-type.json
@@ -0,0 +1 @@ 
+{ 'command': 'foo', 'type': 'bar', 'data': { } }
diff --git a/tests/qapi-schema/double-type.out b/tests/qapi-schema/double-type.out
new file mode 100644
index 0000000..3e244f5
--- /dev/null
+++ b/tests/qapi-schema/double-type.out
@@ -0,0 +1,3 @@ 
+[OrderedDict([('command', 'foo'), ('type', 'bar'), ('data', OrderedDict())])]
+[]
+[OrderedDict([('command', 'foo'), ('type', 'bar'), ('data', OrderedDict())])]
diff --git a/tests/qapi-schema/missing-type.err b/tests/qapi-schema/missing-type.err
new file mode 100644
index 0000000..e69de29
diff --git a/tests/qapi-schema/missing-type.exit b/tests/qapi-schema/missing-type.exit
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/tests/qapi-schema/missing-type.exit
@@ -0,0 +1 @@ 
+0
diff --git a/tests/qapi-schema/missing-type.json b/tests/qapi-schema/missing-type.json
new file mode 100644
index 0000000..9043aa4
--- /dev/null
+++ b/tests/qapi-schema/missing-type.json
@@ -0,0 +1 @@ 
+{ 'data': { } }
diff --git a/tests/qapi-schema/missing-type.out b/tests/qapi-schema/missing-type.out
new file mode 100644
index 0000000..67fd4fa
--- /dev/null
+++ b/tests/qapi-schema/missing-type.out
@@ -0,0 +1,3 @@ 
+[OrderedDict([('data', OrderedDict())])]
+[]
+[]