diff options
Diffstat (limited to 'tests/auto/qml/qjsengine/tst_qjsengine.cpp')
-rw-r--r-- | tests/auto/qml/qjsengine/tst_qjsengine.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index be62908772..6bc0359483 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -227,6 +227,7 @@ private slots: void importModule(); void importModuleRelative(); void importModuleWithLexicallyScopedVars(); + void importExportErrors(); public: Q_INVOKABLE QJSValue throwingCppMethod(); @@ -4404,6 +4405,22 @@ void tst_QJSEngine::importModuleWithLexicallyScopedVars() QCOMPARE(ns.property("main").call().toInt(), 10); } +void tst_QJSEngine::importExportErrors() +{ + { + QJSEngine engine; + QJSValue result = engine.importModule(QStringLiteral(":/importerror1.mjs")); + QVERIFY(result.isError()); + QCOMPARE(result.property("lineNumber").toInt(), 2); + } + { + QJSEngine engine; + QJSValue result = engine.importModule(QStringLiteral(":/exporterror1.mjs")); + QVERIFY(result.isError()); + QCOMPARE(result.property("lineNumber").toInt(), 2); + } +} + QTEST_MAIN(tst_QJSEngine) #include "tst_qjsengine.moc" |