diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qmllint/data/useBeforeDeclaration.qml | 8 | ||||
-rw-r--r-- | tests/auto/qml/qmllint/tst_qmllint.cpp | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qmllint/data/useBeforeDeclaration.qml b/tests/auto/qml/qmllint/data/useBeforeDeclaration.qml new file mode 100644 index 0000000000..1c0f8092c3 --- /dev/null +++ b/tests/auto/qml/qmllint/data/useBeforeDeclaration.qml @@ -0,0 +1,8 @@ +import QtQml +QtObject { + signal sig() + onSig: ()=> { + argq = 12; + var argq; + } +} diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index b874d3cc6f..97840cc2dd 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -277,6 +277,11 @@ void TestQmllint::dirtyQmlCode_data() << QStringLiteral("brokenNamespace.qml") << QString("Warning: type not found in namespace at %1:4:17") << QString(); + QTest::newRow("VariableUsedBeforeDeclaration") + << QStringLiteral("useBeforeDeclaration.qml") + << QStringLiteral("Variable \"argq\" is used before its declaration at 5:9. " + "The declaration is at 6:13.") + << QString(); } void TestQmllint::dirtyQmlCode() |