From 924eab4bcdb8a857f21a6b617d82b870d166ec08 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 13 Jun 2013 18:14:28 +0200 Subject: Remove test case that violates the ecma spec It's actually also hard for us to support this properly, so let's simply not do it. Change-Id: I107e1c1f482d64c9d4d58c805e0446e76e85d840 Reviewed-by: Simon Hausmann --- tests/auto/qml/qjsengine/tst_qjsengine.cpp | 42 ------------------------------ 1 file changed, 42 deletions(-) (limited to 'tests/auto/qml/qjsengine') diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 30a113f535..e0e08d9027 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -121,7 +121,6 @@ private slots: void jsForInStatement_mutateWhileIterating(); void jsForInStatement_arrays(); void jsForInStatement_nullAndUndefined(); - void jsFunctionDeclarationAsStatement(); void stringObjects(); void jsStringPrototypeReplaceBugs(); void getterSetterThisObject_global(); @@ -1891,47 +1890,6 @@ void tst_QJSEngine::jsForInStatement_nullAndUndefined() } } -void tst_QJSEngine::jsFunctionDeclarationAsStatement() -{ - // ECMA-262 does not allow function declarations to be used as statements, - // but several popular implementations (including JSC) do. See the NOTE - // at the beginning of chapter 12 in ECMA-262 5th edition, where it's - // recommended that implementations either disallow this usage or issue - // a warning. - // Since we had a bug report long ago about QtScript not supporting this - // "feature" (and thus deviating from other implementations), we still - // check this behavior. - - QJSEngine eng; - QVERIFY(eng.globalObject().property("bar").isUndefined()); - eng.evaluate("function foo(arg) {\n" - " if (arg == 'bar')\n" - " function bar() { return 'bar'; }\n" - " else\n" - " function baz() { return 'baz'; }\n" - " return (arg == 'bar') ? bar : baz;\n" - "}"); - QVERIFY(eng.globalObject().property("bar").isUndefined()); - QVERIFY(eng.globalObject().property("baz").isUndefined()); - QVERIFY(eng.evaluate("foo").isCallable()); - { - QJSValue ret = eng.evaluate("foo('bar')"); - QVERIFY(ret.isCallable()); - QJSValue ret2 = ret.call(); - QCOMPARE(ret2.toString(), QString::fromLatin1("bar")); - QVERIFY(eng.globalObject().property("bar").isUndefined()); - QVERIFY(eng.globalObject().property("baz").isUndefined()); - } - { - QJSValue ret = eng.evaluate("foo('baz')"); - QVERIFY(ret.isCallable()); - QJSValue ret2 = ret.call(); - QCOMPARE(ret2.toString(), QString::fromLatin1("baz")); - QVERIFY(eng.globalObject().property("bar").isUndefined()); - QVERIFY(eng.globalObject().property("baz").isUndefined()); - } -} - void tst_QJSEngine::stringObjects() { // See ECMA-262 Section 15.5, "String Objects". -- cgit v1.2.3