aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-01-26 10:17:05 +0100
committerUlf Hermann <ulf.hermann@qt.io>2021-01-26 13:19:24 +0100
commit74060990bc83b8714d017da6b2238b00e6aba0e4 (patch)
tree7a4b580fb89436e795c3f8103bf9c010f27827aa /tests/auto/qml
parent7d8552d0753ccf62b14ae3cbdca200602a1050b0 (diff)
QQmlJSTypeReader: Guard against empty JS files
Change-Id: Ie52ce15b7fa960ce84a6d17a21a0e307a38c726e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qmllint/data/Empty.js0
-rw-r--r--tests/auto/qml/qmllint/data/badScript.qml6
-rw-r--r--tests/auto/qml/qmllint/tst_qmllint.cpp4
3 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/Empty.js b/tests/auto/qml/qmllint/data/Empty.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/Empty.js
diff --git a/tests/auto/qml/qmllint/data/badScript.qml b/tests/auto/qml/qmllint/data/badScript.qml
new file mode 100644
index 0000000000..13f3e33acc
--- /dev/null
+++ b/tests/auto/qml/qmllint/data/badScript.qml
@@ -0,0 +1,6 @@
+import QtQml
+import "Empty.js" as Foo
+
+QtObject {
+ objectName: Foo.stuff()
+}
diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp
index f5ef58940b..c1ccae7235 100644
--- a/tests/auto/qml/qmllint/tst_qmllint.cpp
+++ b/tests/auto/qml/qmllint/tst_qmllint.cpp
@@ -269,6 +269,10 @@ void TestQmllint::dirtyQmlCode_data()
<< QStringLiteral("badAliasObject.qml")
<< QString("Warning: Property \"wrongwrongwrong\" not found on type \"QtObject\"")
<< QString();
+ QTest::newRow("badScript")
+ << QStringLiteral("badScript.qml")
+ << QString("Warning: Property \"stuff\" not found on type \"Empty\"")
+ << QString();
}
void TestQmllint::dirtyQmlCode()