diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-05-27 12:39:24 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-06-02 13:13:46 +0000 |
commit | 7c722f423299548a143fed98239dd94c9c287559 (patch) | |
tree | ffa6324e1c577042c41bf9ebef3dc64a24d351d1 /tests/auto/parser | |
parent | e3936b527de67273831310a53f88fcc8f5e21825 (diff) |
Simplify qscxmlc test scxml and merge it into parser test
Change-Id: If51691cff11d9594385fc2642d1ba361758dcf9a
Task-number: QTBUG-53118
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'tests/auto/parser')
76 files changed, 588 insertions, 85 deletions
diff --git a/tests/auto/parser/data/badInitial.scxml b/tests/auto/parser/data/badInitial.scxml new file mode 100644 index 0000000..8247857 --- /dev/null +++ b/tests/auto/parser/data/badInitial.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initial="stopped" +> + <script> + <initial> + + <state id="stopped"> + </state> +</scxml> diff --git a/tests/auto/parser/data/badInitial.scxml.errors b/tests/auto/parser/data/badInitial.scxml.errors new file mode 100644 index 0000000..cd3b53c --- /dev/null +++ b/tests/auto/parser/data/badInitial.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/badInitial.scxml:8:13: error: Unexpected element initial +:/tst_parser/data/badInitial.scxml:12:8: error: Error parsing SCXML file: Opening and ending tag mismatch. +:/tst_parser/data/badInitial.scxml:6:1: error: initial state 'stopped' not found for <scxml> element diff --git a/tests/auto/parser/data/commentInScript.scxml b/tests/auto/parser/data/commentInScript.scxml new file mode 100644 index 0000000..2a663b1 --- /dev/null +++ b/tests/auto/parser/data/commentInScript.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <script><!-- + function isValidMedia() { + var m = _event.data.media + return (m + "").length > 0 + } + <initial> +</scxml> diff --git a/tests/auto/parser/data/commentInScript.scxml.errors b/tests/auto/parser/data/commentInScript.scxml.errors new file mode 100644 index 0000000..d12133f --- /dev/null +++ b/tests/auto/parser/data/commentInScript.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/commentInScript.scxml:6:0: error: Error parsing SCXML file: Premature end of document. diff --git a/tests/auto/parser/data/empty.scxml b/tests/auto/parser/data/empty.scxml new file mode 100644 index 0000000..10c563b --- /dev/null +++ b/tests/auto/parser/data/empty.scxml @@ -0,0 +1 @@ +<scxml></scxml> diff --git a/tests/auto/parser/data/empty.scxml.errors b/tests/auto/parser/data/empty.scxml.errors new file mode 100644 index 0000000..ce558e0 --- /dev/null +++ b/tests/auto/parser/data/empty.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/empty.scxml:2:0: error: Missing root element diff --git a/tests/auto/parser/data/eventnames.scxml.errors b/tests/auto/parser/data/eventnames.scxml.errors new file mode 100644 index 0000000..9b4d5de --- /dev/null +++ b/tests/auto/parser/data/eventnames.scxml.errors @@ -0,0 +1,5 @@ +:/tst_parser/data/eventnames.scxml:50:38: error: '.invalid' is not a valid event +:/tst_parser/data/eventnames.scxml:51:38: error: 'invalid.' is not a valid event +:/tst_parser/data/eventnames.scxml:39:36: error: '.invalid' is not a valid event +:/tst_parser/data/eventnames.scxml:40:36: error: 'invalid.' is not a valid event +:/tst_parser/data/eventnames.scxml:41:36: error: 'in valid' is not a valid event diff --git a/tests/auto/parser/data/ids1.scxml.errors b/tests/auto/parser/data/ids1.scxml.errors new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/auto/parser/data/ids1.scxml.errors diff --git a/tests/auto/parser/data/ids2.scxml.errors b/tests/auto/parser/data/ids2.scxml.errors new file mode 100644 index 0000000..31d8e7c --- /dev/null +++ b/tests/auto/parser/data/ids2.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/ids2.scxml:33:25: error: state name 'foo.bar' is not a valid C++ identifier in Qt mode +:/tst_parser/data/ids2.scxml:34:25: error: state name 'foo-bar' is not a valid C++ identifier in Qt mode +:/tst_parser/data/ids2.scxml:36:19: error: '1' is not a valid XML ID diff --git a/tests/auto/parser/data/invalidContent.scxml b/tests/auto/parser/data/invalidContent.scxml new file mode 100644 index 0000000..232c0ae --- /dev/null +++ b/tests/auto/parser/data/invalidContent.scxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="somewhere"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content /> + <scxml name="anywhere" version="1.0"> + <state id="here"> + </state> + </scxml> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidContent.scxml.errors b/tests/auto/parser/data/invalidContent.scxml.errors new file mode 100644 index 0000000..77db37e --- /dev/null +++ b/tests/auto/parser/data/invalidContent.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/invalidContent.scxml:9:53: error: Unexpected element scxml +:/tst_parser/data/invalidContent.scxml:13:22: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/invalidRoot1.scxml b/tests/auto/parser/data/invalidRoot1.scxml new file mode 100644 index 0000000..f21ad1e --- /dev/null +++ b/tests/auto/parser/data/invalidRoot1.scxml @@ -0,0 +1,5 @@ +<?xml version="1.0" ?> +<Scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidRoot1.scxml.errors b/tests/auto/parser/data/invalidRoot1.scxml.errors new file mode 100644 index 0000000..17a4705 --- /dev/null +++ b/tests/auto/parser/data/invalidRoot1.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/invalidRoot1.scxml:2:61: error: Unknown element Scxml +:/tst_parser/data/invalidRoot1.scxml:5:8: error: Missing root element diff --git a/tests/auto/parser/data/invalidRoot2.scxml b/tests/auto/parser/data/invalidRoot2.scxml new file mode 100644 index 0000000..260373f --- /dev/null +++ b/tests/auto/parser/data/invalidRoot2.scxml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="somewhere"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxmn name="anywhere" version="1.0"> + <state id="there"datamodel + <transition event="goHere" target="here"/> + </state> + </scxml> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidRoot2.scxml.errors b/tests/auto/parser/data/invalidRoot2.scxml.errors new file mode 100644 index 0000000..09e0d81 --- /dev/null +++ b/tests/auto/parser/data/invalidRoot2.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/invalidRoot2.scxml:9:53: error: Unknown element scxmn +:/tst_parser/data/invalidRoot2.scxml:10:38: error: Error parsing SCXML file: Expected '>' or '/', but got '[a-zA-Z]'. +:/tst_parser/data/invalidRoot2.scxml:7:51: error: no valid content found in <invoke> tag diff --git a/tests/auto/parser/data/invalidRoot3.scxml b/tests/auto/parser/data/invalidRoot3.scxml new file mode 100644 index 0000000..e968b20 --- /dev/null +++ b/tests/auto/parser/data/invalidRoot3.scxml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- enable-qt-mode: yeq --> +<scxma + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="anyplace"> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidRoot3.scxml.errors b/tests/auto/parser/data/invalidRoot3.scxml.errors new file mode 100644 index 0000000..e61f590 --- /dev/null +++ b/tests/auto/parser/data/invalidRoot3.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/invalidRoot3.scxml:2:28: error: expected 'yes' or 'no' after enable-qt-mode in comment +:/tst_parser/data/invalidRoot3.scxml:6:1: error: Unknown element scxma +:/tst_parser/data/invalidRoot3.scxml:9:8: error: Missing root element diff --git a/tests/auto/parser/data/invalidRoot6.scxml b/tests/auto/parser/data/invalidRoot6.scxml new file mode 100644 index 0000000..c0633e8 --- /dev/null +++ b/tests/auto/parser/data/invalidRoot6.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="somewhere"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + |scxml name="anywhere" version="1.0"> + <state id="here"> + </state> + <state id="there"> + </state> + </scxml> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidRoot6.scxml.errors b/tests/auto/parser/data/invalidRoot6.scxml.errors new file mode 100644 index 0000000..669b03c --- /dev/null +++ b/tests/auto/parser/data/invalidRoot6.scxml.errors @@ -0,0 +1,4 @@ +:/tst_parser/data/invalidRoot6.scxml:10:37: error: Unexpected element state +:/tst_parser/data/invalidRoot6.scxml:12:38: error: Unexpected element state +:/tst_parser/data/invalidRoot6.scxml:14:24: error: Error parsing SCXML file: Opening and ending tag mismatch. +:/tst_parser/data/invalidRoot6.scxml:7:51: error: no valid content found in <invoke> tag diff --git a/tests/auto/parser/data/invalidUnicode1.scxml b/tests/auto/parser/data/invalidUnicode1.scxml new file mode 100644 index 0000000..8e5493a --- /dev/null +++ b/tests/auto/parser/data/invalidUnicode1.scxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="somewhere"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml name="anywhere" version="1.0"> + <state id="here"> + </state> + </scxml> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidUnicode1.scxml.errors b/tests/auto/parser/data/invalidUnicode1.scxml.errors new file mode 100644 index 0000000..bde9c02 --- /dev/null +++ b/tests/auto/parser/data/invalidUnicode1.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/invalidUnicode1.scxml:7:52: error: Error parsing SCXML file: Unexpected ''. diff --git a/tests/auto/parser/data/invalidXmlHeader1.scxml b/tests/auto/parser/data/invalidXmlHeader1.scxml Binary files differnew file mode 100644 index 0000000..dc0ef36 --- /dev/null +++ b/tests/auto/parser/data/invalidXmlHeader1.scxml diff --git a/tests/auto/parser/data/invalidXmlHeader1.scxml.errors b/tests/auto/parser/data/invalidXmlHeader1.scxml.errors new file mode 100644 index 0000000..0fc223b --- /dev/null +++ b/tests/auto/parser/data/invalidXmlHeader1.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/invalidXmlHeader1.scxml:1:66: error: Missing root element diff --git a/tests/auto/parser/data/invalidXmlHeader2.scxml b/tests/auto/parser/data/invalidXmlHeader2.scxml new file mode 100644 index 0000000..a9ffeb5 --- /dev/null +++ b/tests/auto/parser/data/invalidXmlHeader2.scxml @@ -0,0 +1,5 @@ +<ry>l version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidXmlHeader2.scxml.errors b/tests/auto/parser/data/invalidXmlHeader2.scxml.errors new file mode 100644 index 0000000..c969f8b --- /dev/null +++ b/tests/auto/parser/data/invalidXmlHeader2.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/invalidXmlHeader2.scxml:6:0: error: Missing root element diff --git a/tests/auto/parser/data/invalidstatemachinename.scxml b/tests/auto/parser/data/invalidstatemachinename.scxml new file mode 100644 index 0000000..e47a699 --- /dev/null +++ b/tests/auto/parser/data/invalidstatemachinename.scxml @@ -0,0 +1,6 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + initial="wrapper" name="CalculatortateMachine"> + <state id="wrapper"> + </state> +</scxml> diff --git a/tests/auto/parser/data/invalidstatemachinename.scxml.errors b/tests/auto/parser/data/invalidstatemachinename.scxml.errors new file mode 100644 index 0000000..250adb8 --- /dev/null +++ b/tests/auto/parser/data/invalidstatemachinename.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/invalidstatemachinename.scxml:3:55: error: scxml name 'CalculatortateMachine' is not a valid XML Nmtoken diff --git a/tests/auto/parser/data/misplacedinvoke.scxml b/tests/auto/parser/data/misplacedinvoke.scxml new file mode 100644 index 0000000..fe5e5de --- /dev/null +++ b/tests/auto/parser/data/misplacedinvoke.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + xmlns:conf="http://www.w3.org/2005/scxml-conformance" + initial="p01" version="1.0"> + <state id="p01"> + <invoke type="http://Www.w3.org/TR/scxml/"> + <content> + <scxml version="1.0" initial="subFinal1" datamodel="ecmascript"> + <final id="subFinal1"></final> + </scxml> + <finalize> + <assign location="Var1" expr="_event.data.aParam"/> + </finalize> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/parser/data/misplacedinvoke.scxml.errors b/tests/auto/parser/data/misplacedinvoke.scxml.errors new file mode 100644 index 0000000..31c6fa0 --- /dev/null +++ b/tests/auto/parser/data/misplacedinvoke.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/misplacedinvoke.scxml:12:26: error: Unexpected element finalize diff --git a/tests/auto/parser/data/namespaces1.scxml.errors b/tests/auto/parser/data/namespaces1.scxml.errors new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/auto/parser/data/namespaces1.scxml.errors diff --git a/tests/auto/parser/data/nestedScxml.scxml b/tests/auto/parser/data/nestedScxml.scxml new file mode 100644 index 0000000..2f96347 --- /dev/null +++ b/tests/auto/parser/data/nestedScxml.scxml @@ -0,0 +1,7 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + datamodel="ecmascript" name="StateMachine"> + <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" + datamodel="ecmascript" name="NestedStateMachine"> + </scxml> +</scxml> diff --git a/tests/auto/parser/data/nestedScxml.scxml.errors b/tests/auto/parser/data/nestedScxml.scxml.errors new file mode 100644 index 0000000..1735855 --- /dev/null +++ b/tests/auto/parser/data/nestedScxml.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/nestedScxml.scxml:5:60: error: Unexpected element scxml diff --git a/tests/auto/parser/data/noContentInInvoke1.scxml b/tests/auto/parser/data/noContentInInvoke1.scxml new file mode 100644 index 0000000..6d5fc1a --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke1.scxml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="somewhere"> + <invoke type="http://www.w3.org/TR/scxml/"> + <contenscxml name="anywhere" version="1.0"> + <state id="there"> + </state> + </scxml> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/parser/data/noContentInInvoke1.scxml.errors b/tests/auto/parser/data/noContentInInvoke1.scxml.errors new file mode 100644 index 0000000..ec7a4a4 --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke1.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/noContentInInvoke1.scxml:8:55: error: Unknown element contenscxml +:/tst_parser/data/noContentInInvoke1.scxml:11:24: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/noContentInInvoke2.scxml b/tests/auto/parser/data/noContentInInvoke2.scxml new file mode 100644 index 0000000..50e6c37 --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke2.scxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initial="anyplace" +> + <state id="anyp\ace"> + <invoke type="http://www.w3.org/TR/scxml/"> + <contenon use t <sl name="anywhere version="1.0"> + <state id="here"> + </state> + </scxml> + * Redistr </content> + </invoke> + , </state> +</scxml> diff --git a/tests/auto/parser/data/noContentInInvoke2.scxml.errors b/tests/auto/parser/data/noContentInInvoke2.scxml.errors new file mode 100644 index 0000000..f2fa468 --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke2.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/noContentInInvoke2.scxml:9:27: error: Error parsing SCXML file: Expected '=', but got '[a-zA-Z]'. +:/tst_parser/data/noContentInInvoke2.scxml:6:1: error: initial state 'anyplace' not found for <scxml> element +:/tst_parser/data/noContentInInvoke2.scxml:7:25: error: 'anyp\ace' is not a valid XML ID diff --git a/tests/auto/parser/data/noContentInInvoke3.scxml b/tests/auto/parser/data/noContentInInvoke3.scxml Binary files differnew file mode 100644 index 0000000..918e120 --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke3.scxml diff --git a/tests/auto/parser/data/noContentInInvoke3.scxml.errors b/tests/auto/parser/data/noContentInInvoke3.scxml.errors new file mode 100644 index 0000000..d2e762b --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke3.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/noContentInInvoke3.scxml:10:25: error: Error parsing SCXML file: Expected '=', but got '[a-zA-Z]'. +:/tst_parser/data/noContentInInvoke3.scxml:6:1: error: initial state 'anyplace' not found for <scxml> element diff --git a/tests/auto/parser/data/noContentInInvoke4.scxml b/tests/auto/parser/data/noContentInInvoke4.scxml new file mode 100644 index 0000000..2782daf --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke4.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" + initial="anyplacE" +> + <state id="anyplace"> + <transition event="goSomewhere" target="somewhere"/> + + <state id="s* LIMITomewhere"> + <invoke type="http://www.w$.org/TR/scxml/"> + <content> + <scxml name="anywhere" version="1.0"> + <sta e id="here"> + </state> + </scxm8> + </content> + </invoke> + </state> + </state> +</scxml> diff --git a/tests/auto/parser/data/noContentInInvoke4.scxml.errors b/tests/auto/parser/data/noContentInInvoke4.scxml.errors new file mode 100644 index 0000000..8ec3192 --- /dev/null +++ b/tests/auto/parser/data/noContentInInvoke4.scxml.errors @@ -0,0 +1,4 @@ +:/tst_parser/data/noContentInInvoke4.scxml:12:6: error: Error parsing SCXML file: Unexpected ''. +:/tst_parser/data/noContentInInvoke4.scxml:6:1: error: initial state 'anyplacE' not found for <scxml> element +:/tst_parser/data/noContentInInvoke4.scxml:8:60: error: unknown state 'somewhere' in target +:/tst_parser/data/noContentInInvoke4.scxml:10:37: error: 's* LIMITomewhere' is not a valid XML ID diff --git a/tests/auto/parser/data/prematureEndOfDocument1.scxml b/tests/auto/parser/data/prematureEndOfDocument1.scxml new file mode 100644 index 0000000..63d938c --- /dev/null +++ b/tests/auto/parser/data/prematureEndOfDocument1.scxml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- enable-qt-mode: yes m-> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="anyplace"> + </state> +</scxml> diff --git a/tests/auto/parser/data/prematureEndOfDocument1.scxml.errors b/tests/auto/parser/data/prematureEndOfDocument1.scxml.errors new file mode 100644 index 0000000..24ae3e9 --- /dev/null +++ b/tests/auto/parser/data/prematureEndOfDocument1.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/prematureEndOfDocument1.scxml:2:0: error: Missing root element diff --git a/tests/auto/parser/data/prematureEndOfDocument2.scxml b/tests/auto/parser/data/prematureEndOfDocument2.scxml new file mode 100644 index 0000000..e1fde76 --- /dev/null +++ b/tests/auto/parser/data/prematureEndOfDocument2.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="anyplace"> + <state id="somewhere"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> +<!-- <scxml name="anywhere" version="1.0"> + <state id="here"> + <transition event="goThere" target="there"/> + </state> + <state id="there"> + <transition event="goHere" target="here"/> + </state> + </scxml> + </content> + </invoke> + </state> + </state> +</scxml> diff --git a/tests/auto/parser/data/prematureEndOfDocument2.scxml.errors b/tests/auto/parser/data/prematureEndOfDocument2.scxml.errors new file mode 100644 index 0000000..619f08f --- /dev/null +++ b/tests/auto/parser/data/prematureEndOfDocument2.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/prematureEndOfDocument2.scxml:10:0: error: Error parsing SCXML file: Premature end of document. +:/tst_parser/data/prematureEndOfDocument2.scxml:8:55: error: no valid content found in <invoke> tag diff --git a/tests/auto/parser/data/qtmode.scxml.errors b/tests/auto/parser/data/qtmode.scxml.errors new file mode 100644 index 0000000..fd3671f --- /dev/null +++ b/tests/auto/parser/data/qtmode.scxml.errors @@ -0,0 +1,7 @@ +:/tst_parser/data/qtmode.scxml:35:31: error: event name 'a' collides with a state name 'a' in Qt mode +:/tst_parser/data/qtmode.scxml:36:34: error: event name 'void' is not a valid C++ identifier in Qt mode +:/tst_parser/data/qtmode.scxml:37:38: error: event name 'aChanged' collides with a state name 'a' in Qt mode +:/tst_parser/data/qtmode.scxml:38:38: error: event name 'finished' is not a valid Qt identifier in Qt mode +:/tst_parser/data/qtmode.scxml:42:21: error: state name 'int' is not a valid C++ identifier in Qt mode +:/tst_parser/data/qtmode.scxml:43:28: error: state name 'objectName' is not a valid Qt identifier in Qt mode +:/tst_parser/data/qtmode.scxml:45:28: error: state name 'fooChanged' collides with a state name 'foo' in Qt mode diff --git a/tests/auto/parser/data/scxml1.scxml.errors b/tests/auto/parser/data/scxml1.scxml.errors new file mode 100644 index 0000000..870d167 --- /dev/null +++ b/tests/auto/parser/data/scxml1.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/scxml1.scxml:32:36: error: Unsupported data model 'foo' in scxml +:/tst_parser/data/scxml1.scxml:34:30: error: Unexpected element scxml diff --git a/tests/auto/parser/data/scxml2.scxml.errors b/tests/auto/parser/data/scxml2.scxml.errors new file mode 100644 index 0000000..a9f0e30 --- /dev/null +++ b/tests/auto/parser/data/scxml2.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/scxml2.scxml:32:34: error: Unsupperted binding type 'foo' diff --git a/tests/auto/parser/data/syntaxErrors1.scxml b/tests/auto/parser/data/syntaxErrors1.scxml new file mode 100644 index 0000000..64e25f0 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors1.scxml @@ -0,0 +1,14 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="begin"> + <transitifn event="OPER.MINUS" target="negated1" /> + </state> + + <state id="negated1"> + nameate> + </state> + <transition event="OP.INSERT"> + <assigZ location="long_expr" expr="long_expr+'+'" /> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors1.scxml.errors b/tests/auto/parser/data/syntaxErrors1.scxml.errors new file mode 100644 index 0000000..ac98603 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors1.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/syntaxErrors1.scxml:4:59: error: Unknown element transitifn +:/tst_parser/data/syntaxErrors1.scxml:11:64: error: Unknown element assigZ +:/tst_parser/data/syntaxErrors1.scxml:13:12: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors10.scxml b/tests/auto/parser/data/syntaxErrors10.scxml new file mode 100644 index 0000000..257cc26 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors10.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="workflow"> + <transition event="updateLights"> + |if cond="In('lightImpulseOn')"> + <raise event="dings"/> + <else/> + <raise event="turnOffGameOver"/> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors10.scxml.errors b/tests/auto/parser/data/syntaxErrors10.scxml.errors new file mode 100644 index 0000000..786d6ce --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors10.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/syntaxErrors10.scxml:7:19: error: Unexpected element else +:/tst_parser/data/syntaxErrors10.scxml:9:17: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors11.scxml b/tests/auto/parser/data/syntaxErrors11.scxml new file mode 100644 index 0000000..0ab2c58 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors11.scxml @@ -0,0 +1,10 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + <transition event="OP.INSERT"> + <if cond="_event.data.operator == 'OPER.PLUS'"> + <Assign location="long_expr" expr="long_expr+'-'" /> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors11.scxml.errors b/tests/auto/parser/data/syntaxErrors11.scxml.errors new file mode 100644 index 0000000..3d34249 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors11.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/syntaxErrors11.scxml:6:68: error: Unknown element Assign diff --git a/tests/auto/parser/data/syntaxErrors12.scxml b/tests/auto/parser/data/syntaxErrors12.scxml new file mode 100644 index 0000000..9295c01 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors12.scxml @@ -0,0 +1,16 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + <transition event="OP.INSERT"> + <if cond="_event.data.operator == 'OPER.PLUS'"> + <assign location="long_expr">expr="long_expr+'+'" /> + <elseif cond="_event.data.operator=='OPER.MINUS'" /> + <assign location="long_expr" expr="long_expr+'-'" /> + <elseif cond="_event.data.operator=='OPER.STAR'" /> + <assign location="long_expr" expr="long_expr+'*'" /> + <elseif cond="_event.data.operator=='OPER.DIV'" /> + <assign location="long_expr" expr="long_expr+'/'" /> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors12.scxml.errors b/tests/auto/parser/data/syntaxErrors12.scxml.errors new file mode 100644 index 0000000..df27955 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors12.scxml.errors @@ -0,0 +1,7 @@ +:/tst_parser/data/syntaxErrors12.scxml:7:64: error: Unexpected element elseif +:/tst_parser/data/syntaxErrors12.scxml:8:68: error: Unexpected element assign +:/tst_parser/data/syntaxErrors12.scxml:9:63: error: Unexpected element elseif +:/tst_parser/data/syntaxErrors12.scxml:10:68: error: Unexpected element assign +:/tst_parser/data/syntaxErrors12.scxml:11:62: error: Unexpected element elseif +:/tst_parser/data/syntaxErrors12.scxml:12:68: error: Unexpected element assign +:/tst_parser/data/syntaxErrors12.scxml:13:17: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors13.scxml b/tests/auto/parser/data/syntaxErrors13.scxml new file mode 100644 index 0000000..ea0728c --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors13.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + <transition event="OP.INSERT"> + |if cond="_event.data.operator == 'OPER.PLUS'"> + <assign location="long_expr" expr="long_expr+'+'" /> + <elseif cond="_event.data.operator=='OPER.MINUS'" /> + <assign location="long_expr" expr="long_expr+'-'" /> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors13.scxml.errors b/tests/auto/parser/data/syntaxErrors13.scxml.errors new file mode 100644 index 0000000..e3104b2 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors13.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/syntaxErrors13.scxml:7:64: error: Unexpected element elseif +:/tst_parser/data/syntaxErrors13.scxml:9:17: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors14.scxml b/tests/auto/parser/data/syntaxErrors14.scxml new file mode 100644 index 0000000..33890df --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors14.scxml @@ -0,0 +1,10 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + <transition event="OP.INSERT"> + <If cond="_event.data.operator == 'OPER.PLUS'"> + <assign location="long_expr" expr="long_expr+'+'" /> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors14.scxml.errors b/tests/auto/parser/data/syntaxErrors14.scxml.errors new file mode 100644 index 0000000..47bf05c --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors14.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/syntaxErrors14.scxml:5:59: error: Unknown element If +:/tst_parser/data/syntaxErrors14.scxml:7:17: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors15.scxml b/tests/auto/parser/data/syntaxErrors15.scxml new file mode 100644 index 0000000..aeeb686 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors15.scxml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml + xmlns="http://www.w3.org/2005/07/scxml" + version="1.0" +> + <state id="somewhere"> + <invoke type="http://www.w3.org/TR/scxml/"> + http://www.w3.org/2005/07/scxmlscxml name="anywhere" version="1.0"> + <state id="here"> + </state> + <state id="there"> + </state> + </scxml> + </content> + </invoke> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors15.scxml.errors b/tests/auto/parser/data/syntaxErrors15.scxml.errors new file mode 100644 index 0000000..406e65e --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors15.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/syntaxErrors15.scxml:9:37: error: Unexpected element state +:/tst_parser/data/syntaxErrors15.scxml:11:38: error: Unexpected element state +:/tst_parser/data/syntaxErrors15.scxml:13:24: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors2.scxml b/tests/auto/parser/data/syntaxErrors2.scxml new file mode 100644 index 0000000..3c97fa7 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors2.scxml @@ -0,0 +1,14 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="lightImpulseGenerator"> + <transition event="scheduleNewImpulse"> + <if cond="In('offState')"> + <send event="lightImpulse" id="lightId" delay="1s"/> + <elseif cond="In('hurryStateOff')"/> + <send>event="lightImpulse" id="lightId" delay="500ms"/> + <else/> + <send event="lightImpulse" id="lightId" delay="200ms"/> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors2.scxml.errors b/tests/auto/parser/data/syntaxErrors2.scxml.errors new file mode 100644 index 0000000..a86e782 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors2.scxml.errors @@ -0,0 +1,3 @@ +:/tst_parser/data/syntaxErrors2.scxml:9:19: error: Unexpected element else +:/tst_parser/data/syntaxErrors2.scxml:10:71: error: Unexpected element send +:/tst_parser/data/syntaxErrors2.scxml:11:17: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors3.scxml b/tests/auto/parser/data/syntaxErrors3.scxml new file mode 100644 index 0000000..e419851 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors3.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + <state id="ready"> +id="result"> + </state> + </state> + <state id="o]erand1"> + </state> + <state id="operand2"> + <transition event="EQUALS" target="result"> + </transition> + </state> + + <transition event="OP.INSERT"> + <assige location="long_expr" expr="long_expr+'*'" /> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors3.scxml.errors b/tests/auto/parser/data/syntaxErrors3.scxml.errors new file mode 100644 index 0000000..7ee5711 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors3.scxml.errors @@ -0,0 +1,4 @@ +:/tst_parser/data/syntaxErrors3.scxml:16:64: error: Unknown element assige +:/tst_parser/data/syntaxErrors3.scxml:18:12: error: Error parsing SCXML file: Opening and ending tag mismatch. +:/tst_parser/data/syntaxErrors3.scxml:8:29: error: 'o]erand1' is not a valid XML ID +:/tst_parser/data/syntaxErrors3.scxml:11:55: error: unknown state 'result' in target diff --git a/tests/auto/parser/data/syntaxErrors4.scxml b/tests/auto/parser/data/syntaxErrors4.scxml new file mode 100644 index 0000000..4fb8ab9 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors4.scxml @@ -0,0 +1,17 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper" initial="on"> + <state id="on"> + <state id="negated2"> + <state id="operand2"> + </state> + </state> + <transition event="OP.INSERT"> + <if cond="_event.data.operator == 'OPER.PLUS'"> + <assign location="long_expr" expr="long_expr+'+'" /> + <elsDif cond="_event.data.operator=='OPER.MINUS'" /> + <assign location="long_expr" expr="long_expr+'-'" /> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors4.scxml.errors b/tests/auto/parser/data/syntaxErrors4.scxml.errors new file mode 100644 index 0000000..54e7b4f --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors4.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/syntaxErrors4.scxml:12:64: error: Unknown element elsDif +:/tst_parser/data/syntaxErrors4.scxml:17:8: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors5.scxml b/tests/auto/parser/data/syntaxErrors5.scxml new file mode 100644 index 0000000..d711cbd --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors5.scxml @@ -0,0 +1,13 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="wrapper"> + <transition event="OP.INSERT"> + <if cond="_event.data.operator == 'OPER.PLUS'"> + <assign location="long_expr" expr="long_expr+'+'" /> + <elseif cond="_event.data.operator=='OPER.MINUS'" /> + <state id="zero1"> + tion="long_expr" expr="long_expr+'-'" /> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors5.scxml.errors b/tests/auto/parser/data/syntaxErrors5.scxml.errors new file mode 100644 index 0000000..2e80c0b --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors5.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/syntaxErrors5.scxml:8:20: error: Unexpected element state +:/tst_parser/data/syntaxErrors5.scxml:10:17: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/syntaxErrors7.scxml b/tests/auto/parser/data/syntaxErrors7.scxml new file mode 100644 index 0000000..fbe42ce --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors7.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="lightImpulseGenerator"> + <transition event="scheduleNewImpulse"> + <if cond="In('offState')"> + <send event="lightImpulse"/> + <Elseif cond="In('hurryStateOff')"/> + <send event="lightImpulse"/> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors7.scxml.errors b/tests/auto/parser/data/syntaxErrors7.scxml.errors new file mode 100644 index 0000000..228a80b --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors7.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/syntaxErrors7.scxml:7:48: error: Unknown element Elseif diff --git a/tests/auto/parser/data/syntaxErrors9.scxml b/tests/auto/parser/data/syntaxErrors9.scxml new file mode 100644 index 0000000..5b6ad24 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors9.scxml @@ -0,0 +1,12 @@ +<?xml version="1.0" ?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0"> + <state id="workflow"> + <transition event="updateLights"> + |if cond="In('jackpotStateOn')"> + <raise event="turnOnJackpot"/> + <else/> + <raise event="turnOffJackpot"/> + </if> + </transition> + </state> +</scxml> diff --git a/tests/auto/parser/data/syntaxErrors9.scxml.errors b/tests/auto/parser/data/syntaxErrors9.scxml.errors new file mode 100644 index 0000000..cb5b1e9 --- /dev/null +++ b/tests/auto/parser/data/syntaxErrors9.scxml.errors @@ -0,0 +1,2 @@ +:/tst_parser/data/syntaxErrors9.scxml:7:19: error: Unexpected element else +:/tst_parser/data/syntaxErrors9.scxml:9:17: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/test1.scxml.errors b/tests/auto/parser/data/test1.scxml.errors new file mode 100644 index 0000000..bb9d53e --- /dev/null +++ b/tests/auto/parser/data/test1.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/test1.scxml:34:46: error: unknown state 'b' in target diff --git a/tests/auto/parser/tst_parser.cpp b/tests/auto/parser/tst_parser.cpp index 4c0e19f..41927cf 100644 --- a/tests/auto/parser/tst_parser.cpp +++ b/tests/auto/parser/tst_parser.cpp @@ -46,92 +46,32 @@ private Q_SLOTS: void tst_Parser::error_data() { QTest::addColumn<QString>("scxmlFileName"); - QTest::addColumn<QVector<QScxmlError> >("expectedErrors"); - - QVector<QScxmlError> errors; - QString filename; - - filename = QLatin1String(":/tst_parser/data/test1.scxml"); - errors.clear(); - errors << QScxmlError(filename, 34, 46, - QLatin1String("unknown state 'b' in target")); - QTest::newRow("test1") << filename << errors; - - filename = QLatin1String(":/tst_parser/data/namespaces1.scxml"); - errors.clear(); - QTest::newRow("namespaces 1") << filename << errors; - - filename = QLatin1String(":/tst_parser/data/ids1.scxml"); - errors.clear(); - QTest::newRow("IDs 1") << filename << errors; - - filename = QLatin1String(":/tst_parser/data/ids2.scxml"); - errors.clear(); - errors << QScxmlError(filename, 33, 25, - QLatin1String("state name 'foo.bar' is not a valid C++ identifier in Qt mode")); - errors << QScxmlError(filename, 34, 25, - QLatin1String("state name 'foo-bar' is not a valid C++ identifier in Qt mode")); - errors << QScxmlError(filename, 36, 19, - QLatin1String("'1' is not a valid XML ID")); - - QTest::newRow("IDs 2") << filename << errors; - - filename = QLatin1String(":/tst_parser/data/eventnames.scxml"); - errors.clear(); - errors << QScxmlError(filename, 50, 38, - QLatin1String("'.invalid' is not a valid event")); - errors << QScxmlError(filename, 51, 38, - QLatin1String("'invalid.' is not a valid event")); - errors << QScxmlError(filename, 39, 36, - QLatin1String("'.invalid' is not a valid event")); - errors << QScxmlError(filename, 40, 36, - QLatin1String("'invalid.' is not a valid event")); - errors << QScxmlError(filename, 41, 36, - QLatin1String("'in valid' is not a valid event")); - QTest::newRow("eventnames") << filename << errors; - - filename = QString(":/tst_parser/data/qtmode.scxml"); - errors.clear(); - errors << QScxmlError(filename, 35, 31, - QLatin1String("event name 'a' collides with a state name 'a' in Qt mode")); - errors << QScxmlError(filename, 36, 34, - QLatin1String("event name 'void' is not a valid C++ identifier in Qt mode")); - errors << QScxmlError(filename, 37, 38, - QLatin1String("event name 'aChanged' collides with a state name 'a' in Qt mode")); - errors << QScxmlError(filename, 38, 38, - QLatin1String("event name 'finished' is not a valid Qt identifier in Qt mode")); - errors << QScxmlError(filename, 42, 21, - QLatin1String("state name 'int' is not a valid C++ identifier in Qt mode")); - errors << QScxmlError(filename, 43, 28, - QLatin1String("state name 'objectName' is not a valid Qt identifier in Qt mode")); - errors << QScxmlError(filename, 45, 28, - QLatin1String("state name 'fooChanged' collides with a state name 'foo' in Qt mode")); - QTest::newRow("qtmode") << filename << errors; - - filename = QString(":/tst_parser/data/scxml1.scxml"); - errors.clear(); - errors << QScxmlError(filename, 32, 36, - QLatin1String("Unsupported data model 'foo' in scxml")); - errors << QScxmlError(filename, 34, 30, - QLatin1String("Unexpected element scxml")); - QTest::newRow("scxml1") << filename << errors; - - filename = QString(":/tst_parser/data/scxml2.scxml"); - errors.clear(); - errors << QScxmlError(filename, 32, 34, - QLatin1String("Unsupperted binding type 'foo'")); - QTest::newRow("scxml2") << filename << errors; + QTest::addColumn<QString>("errorFileName"); + + QDir dir(QLatin1String(":/tst_parser/data/")); + foreach (const QString &entry, dir.entryList()) { + if (!entry.endsWith(QLatin1String(".errors"))) { + QString scxmlFileName = dir.filePath(entry); + QTest::newRow(entry.toLatin1().constData()) + << scxmlFileName << (scxmlFileName + QLatin1String(".errors")); + } + } } void tst_Parser::error() { QFETCH(QString, scxmlFileName); - QFETCH(QVector<QScxmlError>, expectedErrors); + QFETCH(QString, errorFileName); + + QFile errorFile(errorFileName); + errorFile.open(QIODevice::ReadOnly | QIODevice::Text); + const QStringList expectedErrors = + QString::fromUtf8(errorFile.readAll()).split('\n', QString::SkipEmptyParts); QScopedPointer<QScxmlStateMachine> stateMachine(QScxmlStateMachine::fromFile(scxmlFileName)); QVERIFY(!stateMachine.isNull()); - QVector<QScxmlError> errors = stateMachine->parseErrors(); + const QVector<QScxmlError> errors = stateMachine->parseErrors(); if (errors.count() != expectedErrors.count()) { foreach (const QScxmlError &error, errors) { qDebug() << error.toString(); @@ -139,14 +79,8 @@ void tst_Parser::error() } QCOMPARE(errors.count(), expectedErrors.count()); - for (int i = 0; i < errors.count(); ++i) { - QScxmlError error = errors.at(i); - QScxmlError expectedError = expectedErrors.at(i); - QCOMPARE(error.fileName(), expectedError.fileName()); - QCOMPARE(error.line(), expectedError.line()); - QCOMPARE(error.column(), expectedError.column()); - QCOMPARE(error.description(), expectedError.description()); - } + for (int i = 0; i < errors.count(); ++i) + QCOMPARE(errors.at(i).toString(), expectedErrors.at(i)); } QTEST_MAIN(tst_Parser) diff --git a/tests/auto/parser/tst_parser.qrc b/tests/auto/parser/tst_parser.qrc index 7323c82..0c5f56b 100644 --- a/tests/auto/parser/tst_parser.qrc +++ b/tests/auto/parser/tst_parser.qrc @@ -1,12 +1,86 @@ <RCC> <qresource prefix="/tst_parser"> + <file>data/badInitial.scxml.errors</file> + <file>data/badInitial.scxml</file> + <file>data/commentInScript.scxml.errors</file> + <file>data/commentInScript.scxml</file> + <file>data/empty.scxml.errors</file> + <file>data/empty.scxml</file> + <file>data/eventnames.scxml.errors</file> <file>data/eventnames.scxml</file> + <file>data/ids1.scxml.errors</file> <file>data/ids1.scxml</file> + <file>data/ids2.scxml.errors</file> <file>data/ids2.scxml</file> + <file>data/invalidContent.scxml.errors</file> + <file>data/invalidContent.scxml</file> + <file>data/invalidRoot1.scxml.errors</file> + <file>data/invalidRoot1.scxml</file> + <file>data/invalidRoot2.scxml.errors</file> + <file>data/invalidRoot2.scxml</file> + <file>data/invalidRoot3.scxml.errors</file> + <file>data/invalidRoot3.scxml</file> + <file>data/invalidRoot6.scxml.errors</file> + <file>data/invalidRoot6.scxml</file> + <file>data/invalidstatemachinename.scxml.errors</file> + <file>data/invalidstatemachinename.scxml</file> + <file>data/invalidUnicode1.scxml.errors</file> + <file>data/invalidUnicode1.scxml</file> + <file>data/invalidXmlHeader1.scxml.errors</file> + <file>data/invalidXmlHeader1.scxml</file> + <file>data/invalidXmlHeader2.scxml.errors</file> + <file>data/invalidXmlHeader2.scxml</file> + <file>data/misplacedinvoke.scxml.errors</file> + <file>data/misplacedinvoke.scxml</file> + <file>data/namespaces1.scxml.errors</file> <file>data/namespaces1.scxml</file> + <file>data/nestedScxml.scxml.errors</file> + <file>data/nestedScxml.scxml</file> + <file>data/noContentInInvoke1.scxml.errors</file> + <file>data/noContentInInvoke1.scxml</file> + <file>data/noContentInInvoke2.scxml.errors</file> + <file>data/noContentInInvoke2.scxml</file> + <file>data/noContentInInvoke3.scxml.errors</file> + <file>data/noContentInInvoke3.scxml</file> + <file>data/noContentInInvoke4.scxml.errors</file> + <file>data/noContentInInvoke4.scxml</file> + <file>data/prematureEndOfDocument1.scxml.errors</file> + <file>data/prematureEndOfDocument1.scxml</file> + <file>data/prematureEndOfDocument2.scxml.errors</file> + <file>data/prematureEndOfDocument2.scxml</file> + <file>data/qtmode.scxml.errors</file> <file>data/qtmode.scxml</file> + <file>data/scxml1.scxml.errors</file> <file>data/scxml1.scxml</file> + <file>data/scxml2.scxml.errors</file> <file>data/scxml2.scxml</file> + <file>data/syntaxErrors10.scxml.errors</file> + <file>data/syntaxErrors10.scxml</file> + <file>data/syntaxErrors11.scxml.errors</file> + <file>data/syntaxErrors11.scxml</file> + <file>data/syntaxErrors12.scxml.errors</file> + <file>data/syntaxErrors12.scxml</file> + <file>data/syntaxErrors13.scxml.errors</file> + <file>data/syntaxErrors13.scxml</file> + <file>data/syntaxErrors14.scxml.errors</file> + <file>data/syntaxErrors14.scxml</file> + <file>data/syntaxErrors15.scxml.errors</file> + <file>data/syntaxErrors15.scxml</file> + <file>data/syntaxErrors1.scxml.errors</file> + <file>data/syntaxErrors1.scxml</file> + <file>data/syntaxErrors2.scxml.errors</file> + <file>data/syntaxErrors2.scxml</file> + <file>data/syntaxErrors3.scxml.errors</file> + <file>data/syntaxErrors3.scxml</file> + <file>data/syntaxErrors4.scxml.errors</file> + <file>data/syntaxErrors4.scxml</file> + <file>data/syntaxErrors5.scxml.errors</file> + <file>data/syntaxErrors5.scxml</file> + <file>data/syntaxErrors7.scxml.errors</file> + <file>data/syntaxErrors7.scxml</file> + <file>data/syntaxErrors9.scxml.errors</file> + <file>data/syntaxErrors9.scxml</file> + <file>data/test1.scxml.errors</file> <file>data/test1.scxml</file> </qresource> </RCC> |