summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2012-11-26 10:43:17 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-26 23:23:08 +0100
commitd0a744adea8d213d00f248ac04fb18e5baed53a2 (patch)
tree094c9257c34403944c866aff771ba2efeb409639 /tests
parent140b883402412f4eade4016f0fedd9b7799660bd (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.) This is a "port" of a similair change done in the qtdeclarative module. Change-Id: I417cf18abb75e7040c48894b8f8f68afc41547fe Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/compatibilitySemicolon.qml11
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp11
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/compatibilitySemicolon.qml b/tests/auto/declarative/qdeclarativelanguage/data/compatibilitySemicolon.qml
new file mode 100644
index 00000000..117925e6
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativelanguage/data/compatibilitySemicolon.qml
@@ -0,0 +1,11 @@
+import QtQuick 1.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/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index eff8b8ad..11633c06 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -158,6 +158,8 @@ private slots:
void crash1();
void crash2();
+ void compatibilitySemicolon();
+
private:
QDeclarativeEngine engine;
void testType(const QString& qml, const QString& type, const QString& error);
@@ -2009,6 +2011,15 @@ void tst_qdeclarativelanguage::aliasPropertyChangeSignals()
}
}
+void tst_qdeclarativelanguage::compatibilitySemicolon()
+{
+ QDeclarativeComponent component(&engine, testFileUrl("compatibilitySemicolon.qml"));
+
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+}
+
QTEST_MAIN(tst_qdeclarativelanguage)
#include "tst_qdeclarativelanguage.moc"