aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qjsengine
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-06-13 18:14:28 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-06-13 18:50:25 +0200
commit924eab4bcdb8a857f21a6b617d82b870d166ec08 (patch)
treeaa5b3794cee94da808464449e233e6cc1106839b /tests/auto/qml/qjsengine
parentcb8273289848fd1d8ddf9d37327e5211d959595a (diff)
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 <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/qml/qjsengine')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp42
1 files changed, 0 insertions, 42 deletions
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".