From b86b05ed60d8d49c5770851860d4e6b89c133e7e Mon Sep 17 00:00:00 2001 From: Wenchao Xia Date: Tue, 4 Mar 2014 18:44:34 -0800 Subject: qapi script: check correctness of union Since line info is remembered as QAPISchema.line now, this patch uses it as additional info for every expr in QAPISchema inside qapi.py, then improves error message with it in checking of exprs. For common union the patch will check whether base is a valid complex type if specified. For flat union it will check whether base presents, whether discriminator is found in base, whether the key of every branch is correct when discriminator is an enum type. Signed-off-by: Wenchao Xia Reviewed-by: Markus Armbruster Signed-off-by: Luiz Capitulino --- tests/qapi-schema/union-invalid-base.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/qapi-schema/union-invalid-base.json (limited to 'tests/qapi-schema/union-invalid-base.json') diff --git a/tests/qapi-schema/union-invalid-base.json b/tests/qapi-schema/union-invalid-base.json new file mode 100644 index 0000000000..1fa4930010 --- /dev/null +++ b/tests/qapi-schema/union-invalid-base.json @@ -0,0 +1,10 @@ +{ 'type': 'TestTypeA', + 'data': { 'string': 'str' } } + +{ 'type': 'TestTypeB', + 'data': { 'integer': 'int' } } + +{ 'union': 'TestUnion', + 'base': 'TestBaseWrong', + 'data': { 'value1': 'TestTypeA', + 'value2': 'TestTypeB' } } -- cgit v1.2.3