From 445a52209db72287f7bd57f01fbb54b102bb042b Mon Sep 17 00:00:00 2001 From: Semih Yavuz Date: Tue, 7 Nov 2023 15:02:24 +0100 Subject: qtscxml: Error out when no script content given Standard says https://www.w3.org/TR/scxml/#script that there should be either src or some content in the script tag. Compiling should fail with non-conformant .scxml files. Adjust the number of the errors in a few test because of newly added error. Pick-to: 5.15 6.5 6.6 Fixes: QTBUG-118050 Change-Id: Ib72f7cca53e427a5a83a6aaa3a8a197818e8693f Reviewed-by: Qt CI Bot Reviewed-by: Ulf Hermann --- tests/auto/parser/CMakeLists.txt | 2 ++ tests/auto/parser/data/badInitial.scxml.errors | 1 + tests/auto/parser/data/commentInScript.scxml.errors | 1 + tests/auto/parser/data/emptyScript.scxml | 12 ++++++++++++ tests/auto/parser/data/emptyScript.scxml.errors | 1 + 5 files changed, 17 insertions(+) create mode 100644 tests/auto/parser/data/emptyScript.scxml create mode 100644 tests/auto/parser/data/emptyScript.scxml.errors (limited to 'tests') diff --git a/tests/auto/parser/CMakeLists.txt b/tests/auto/parser/CMakeLists.txt index d441703..0e05699 100644 --- a/tests/auto/parser/CMakeLists.txt +++ b/tests/auto/parser/CMakeLists.txt @@ -97,6 +97,8 @@ set(tst_parser_resource_files "data/syntaxErrors9.scxml.errors" "data/test1.scxml" "data/test1.scxml.errors" + "data/emptyScript.scxml" + "data/emptyScript.scxml.errors" ) qt_internal_add_resource(tst_scxml_parser "tst_parser" diff --git a/tests/auto/parser/data/badInitial.scxml.errors b/tests/auto/parser/data/badInitial.scxml.errors index fa2eba9..fc0b240 100644 --- a/tests/auto/parser/data/badInitial.scxml.errors +++ b/tests/auto/parser/data/badInitial.scxml.errors @@ -1,2 +1,3 @@ :/tst_parser/data/badInitial.scxml:8:13: error: Unexpected element initial +:/tst_parser/data/badInitial.scxml:7:12: error: neither src nor any content has been given in the script tag :/tst_parser/data/badInitial.scxml:12:8: error: Error parsing SCXML file: Opening and ending tag mismatch. diff --git a/tests/auto/parser/data/commentInScript.scxml.errors b/tests/auto/parser/data/commentInScript.scxml.errors index d12133f..211becb 100644 --- a/tests/auto/parser/data/commentInScript.scxml.errors +++ b/tests/auto/parser/data/commentInScript.scxml.errors @@ -1 +1,2 @@ +:/tst_parser/data/commentInScript.scxml:6:12: error: neither src nor any content has been given in the script tag :/tst_parser/data/commentInScript.scxml:6:0: error: Error parsing SCXML file: Premature end of document. diff --git a/tests/auto/parser/data/emptyScript.scxml b/tests/auto/parser/data/emptyScript.scxml new file mode 100644 index 0000000..48dd53b --- /dev/null +++ b/tests/auto/parser/data/emptyScript.scxml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/auto/parser/data/emptyScript.scxml.errors b/tests/auto/parser/data/emptyScript.scxml.errors new file mode 100644 index 0000000..bbd55a4 --- /dev/null +++ b/tests/auto/parser/data/emptyScript.scxml.errors @@ -0,0 +1 @@ +:/tst_parser/data/emptyScript.scxml:5:20: error: neither src nor any content has been given in the script tag \ No newline at end of file -- cgit v1.2.3