aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-01-06 17:08:41 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-01-07 14:11:49 +0100
commit6dfbbc2a5435d2e9542e9cf2eb039147db0ff29b (patch)
tree9c951d175db4c52ee92bf2c47b79242cd3d12604 /tests
parent49cf23bd2a14e2ca7236b261d7960588f07f5a0b (diff)
QV4: Support printing arrays with circular references
Fixes: QTBUG-81105 Change-Id: Iaf0597cea3a5572f020c5f87a843774f33cc01fd Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 56d2ce8730..b9df69d2db 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -258,6 +258,7 @@ private slots:
void tostringRecursionCheck();
void arrayIncludesWithLargeArray();
+ void printCircularArray();
public:
Q_INVOKABLE QJSValue throwingCppMethod1();
@@ -5054,6 +5055,18 @@ void tst_QJSEngine::arrayIncludesWithLargeArray()
QCOMPARE(value.toBool(), false);
}
+void tst_QJSEngine::printCircularArray()
+{
+ QJSEngine engine;
+ engine.installExtensions(QJSEngine::ConsoleExtension);
+ QTest::ignoreMessage(QtMsgType::QtDebugMsg, "[[Circular]]");
+ auto value = engine.evaluate(R"js(
+ let v1 = []
+ v1.push(v1)
+ console.log(v1)
+ )js");
+}
+
QTEST_MAIN(tst_QJSEngine)
#include "tst_qjsengine.moc"