summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/scxml/qscxmlcompiler.cpp3
-rw-r--r--tests/auto/parser/CMakeLists.txt2
-rw-r--r--tests/auto/parser/data/badInitial.scxml.errors1
-rw-r--r--tests/auto/parser/data/commentInScript.scxml.errors1
-rw-r--r--tests/auto/parser/data/emptyScript.scxml12
-rw-r--r--tests/auto/parser/data/emptyScript.scxml.errors1
6 files changed, 20 insertions, 0 deletions
diff --git a/src/scxml/qscxmlcompiler.cpp b/src/scxml/qscxmlcompiler.cpp
index ffd0ab6..eaf7171 100644
--- a/src/scxml/qscxmlcompiler.cpp
+++ b/src/scxml/qscxmlcompiler.cpp
@@ -2048,6 +2048,9 @@ bool QScxmlCompilerPrivate::postReadElementScript()
scriptI->content = QString::fromUtf8(data);
}
}
+ } else {
+ addError(scriptI->xmlLocation,
+ QStringLiteral("neither src nor any content has been given in the script tag"));
}
return flushInstruction();
}
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" binding="early" xmlns:qt="http://www.qt.io/2015/02/scxml-ext" name="StateChart" qt:editorversion="11.0.1">
+ <state id="Initial">
+ <transition type="external" event="crash" target="Final_1">
+ <script>
+ </script>
+ </transition>
+ </state>
+ <final id="Final_1">
+ </final>
+</scxml>
+
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