aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 696566d987..2291c31895 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -241,6 +241,7 @@ private slots:
void topLevelGeneratorFunction();
void generatorCrashNewProperty();
void generatorCallsGC();
+ void noYieldInInnerFunction();
void qtbug_10696();
void qtbug_11606();
void qtbug_11600();
@@ -6516,6 +6517,19 @@ void tst_qqmlecmascript::generatorCallsGC()
QVERIFY2(o != nullptr, qPrintable(component.errorString()));
}
+void tst_qqmlecmascript::noYieldInInnerFunction()
+{
+ QJSEngine engine;
+ const QString program = R"(
+ function *a() {
+ (function() { yield 1; })();
+ };
+ )";
+ auto result = engine.evaluate(program);
+ QVERIFY(result.isError());
+ QCOMPARE(result.errorType(), QJSValue::SyntaxError);
+}
+
// Test the "Qt.include" method
void tst_qqmlecmascript::include()
{