From 89636733ba3872b9c29ed712e0723b576f65f3ff Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 20 Nov 2020 13:13:23 +0100 Subject: qmllint: Don't crash when importing ES modules Change-Id: Ica93a3e3fb0eb99be1498f1fcb94b09c113272d7 Reviewed-by: Fabian Kosmale --- tests/auto/qml/qmllint/data/jsmoduleimport.qml | 6 ++++++ tests/auto/qml/qmllint/data/script.mjs | 4 ++++ tests/auto/qml/qmllint/tst_qmllint.cpp | 1 + 3 files changed, 11 insertions(+) create mode 100644 tests/auto/qml/qmllint/data/jsmoduleimport.qml create mode 100644 tests/auto/qml/qmllint/data/script.mjs (limited to 'tests/auto/qml') diff --git a/tests/auto/qml/qmllint/data/jsmoduleimport.qml b/tests/auto/qml/qmllint/data/jsmoduleimport.qml new file mode 100644 index 0000000000..c1fad7fee2 --- /dev/null +++ b/tests/auto/qml/qmllint/data/jsmoduleimport.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +import "script.mjs" as Script + +QtObject { + property bool ok: Script.ok() +} diff --git a/tests/auto/qml/qmllint/data/script.mjs b/tests/auto/qml/qmllint/data/script.mjs new file mode 100644 index 0000000000..459c336125 --- /dev/null +++ b/tests/auto/qml/qmllint/data/script.mjs @@ -0,0 +1,4 @@ + +export function ok() { + return true +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index 7ad5ee136e..7e21c8d437 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -290,6 +290,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("anchors2") << QStringLiteral("anchors2.qml"); QTest::newRow("optionalImport") << QStringLiteral("optionalImport.qml"); QTest::newRow("goodAliasObject") << QStringLiteral("goodAliasObject.qml"); + QTest::newRow("jsmoduleimport") << QStringLiteral("jsmoduleimport.qml"); } void TestQmllint::cleanQmlCode() -- cgit v1.2.3