From cb9ea3df7ed10b61cfdfb1ad40d3183f7996a833 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 21 Feb 2018 15:06:53 +0100 Subject: Make sure we can call properties of constants This might not be the most useful thing to have, but it's part of JS, so we better handle it. Task-number: QTBUG-66027 Change-Id: Ib40c90515a3ffd1d065d962d6c79a5e3960e2703 Reviewed-by: Simon Hausmann --- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 5e752d124b..ecd7bea1c4 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -350,6 +350,7 @@ private slots: void localForInIterator(); void shadowedFunctionName(); void anotherNaN(); + void callPropertyOnUndefined(); private: // static void propertyVarWeakRefCallback(v8::Persistent object, void* parameter); @@ -8467,7 +8468,17 @@ void tst_qqmlecmascript::shadowedFunctionName() QCOMPARE(v.toBool(), true); } - +void tst_qqmlecmascript::callPropertyOnUndefined() +{ + QJSEngine engine; + QJSValue v = engine.evaluate(QString::fromLatin1( + "function f() {\n" + " var base;\n" + " base.push(1);" + "}\n" + )); + QVERIFY(!v.isError()); // well, more importantly: this shouldn't fail on an assert. +} QTEST_MAIN(tst_qqmlecmascript) -- cgit v1.2.3