diff options
Diffstat (limited to 'tests/auto/qml/v4misc/tst_v4misc.cpp')
-rw-r--r-- | tests/auto/qml/v4misc/tst_v4misc.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/v4misc/tst_v4misc.cpp b/tests/auto/qml/v4misc/tst_v4misc.cpp index ecc3a4100c..71f0a42907 100644 --- a/tests/auto/qml/v4misc/tst_v4misc.cpp +++ b/tests/auto/qml/v4misc/tst_v4misc.cpp @@ -43,6 +43,8 @@ private slots: void subClassing_data(); void subClassing(); + + void nestingDepth(); }; void tst_v4misc::tdzOptimizations_data() @@ -173,6 +175,28 @@ void tst_v4misc::subClassing() QVERIFY(!result.isError()); } +void tst_v4misc::nestingDepth() +{ + { // left recursive + QString s(40000, '`'); + + QJSEngine engine; + QJSValue result = engine.evaluate(s); + QVERIFY(result.isError()); + QCOMPARE(result.toString(), "SyntaxError: Maximum statement or expression depth exceeded"); + } + + { // right recursive + QString s(200000, '-'); + s += "\nd"; + + QJSEngine engine; + QJSValue result = engine.evaluate(s); + QVERIFY(result.isError()); + QCOMPARE(result.toString(), "SyntaxError: Maximum statement or expression depth exceeded"); + } +} + QTEST_MAIN(tst_v4misc); #include "tst_v4misc.moc" |