diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-01-10 15:34:38 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-01-12 07:04:44 +0000 |
commit | 4588e73020731c5e9527734f89bc55f7630435e1 (patch) | |
tree | 5945c242ac7ead6f3e1d0e2cfd46e85858d5aa1a /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | 4a29f6881be30d34b2f171727eb13a08457c6d7b (diff) |
Arguments passed to functions should shadow the function name
Task-number: QTBUG-65140
Change-Id: I6c6b24f081b31ef0f16fec9b2024485acec11c2d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 64cf27ae1f..8913fa2f2e 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -347,6 +347,7 @@ private slots: void manyArguments(); void forInIterator(); void localForInIterator(); + void shadowedFunctionName(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -8423,6 +8424,20 @@ void tst_qqmlecmascript::localForInIterator() QCOMPARE(ret.toString(), QStringLiteral("3")); } +void tst_qqmlecmascript::shadowedFunctionName() +{ + // verify that arguments shadow the function name + QJSEngine engine; + QJSValue v = engine.evaluate(QString::fromLatin1( + "function f(f) { return f; }\n" + "f(true)\n" + )); + QVERIFY(!v.isError()); + QVERIFY(v.isBool()); + QCOMPARE(v.toBool(), true); +} + + QTEST_MAIN(tst_qqmlecmascript) |