diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2012-11-22 09:39:22 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-26 20:19:35 +0100 |
commit | 224316b515ed42411c43e1be8997c2d8faedc45e (patch) | |
tree | 97468edf428ae0d3f7253ed03a1a9d4f501b511a /tests | |
parent | e9e49c6157f7cfb84faeaab0438b0a30380f68f8 (diff) |
Accept missing semicolon after do-while statement.
Although not valid according to ECMA 5.1, both JSC and V8 accept a
missing semicolon after a do-while loop. (Both JSC and V8 do not do this
through automatic semicolon insertion, but handle it as a special case.)
Change-Id: Iff2b07b894564740d2dcbf9b1d46bc279d30b9e3
Reviewed-by: Alan Alpert <aalpert@rim.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml | 13 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 8 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml b/tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml new file mode 100644 index 0000000000..594a1b3605 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/compatibilitySemicolon.qml @@ -0,0 +1,13 @@ + +import QtQuick 2.0 + +QtObject { + function code() { + + // Not correct according to ECMA 5.1, but JSC and V8 accept the following: + do { + ; + } while (false) true + } +} + diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 0ae06681fd..a99c5fa8be 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -265,6 +265,7 @@ private slots: void registeredFlagMethod(); void deleteLaterObjectMethodCall(); void automaticSemicolon(); + void compatibilitySemicolon(); void unaryExpression(); void switchStatement(); void withStatement(); @@ -6600,6 +6601,13 @@ void tst_qqmlecmascript::automaticSemicolon() QVERIFY(object != 0); } +void tst_qqmlecmascript::compatibilitySemicolon() +{ + QQmlComponent component(&engine, testFileUrl("compatibilitySemicolon.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); +} + void tst_qqmlecmascript::unaryExpression() { QQmlComponent component(&engine, testFileUrl("unaryExpression.qml")); |