aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@qt.io>2018-02-21 15:06:53 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2018-02-23 12:38:19 +0000
commitcb9ea3df7ed10b61cfdfb1ad40d3183f7996a833 (patch)
tree74ed85566cee4b0b5dde5d77ca41fdb826e6972b /tests/auto/qml
parent0761786fc96ff68550697e5386274c7418c73031 (diff)
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 <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp13
1 files changed, 12 insertions, 1 deletions
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<v8::Value> 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)