aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2012-12-20 10:31:46 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-08 15:12:17 +0100
commit5a902969566a4ca7e3937cfe61876a7fbaeb775b (patch)
tree37ebc85558c3ba0b3615f260529cf6b237a90880 /tests/auto/qml
parent58985b94679f38bcea15210dbe5dc6e95168ee2b (diff)
Fix semicolon insertion before pre-incr/decr operators.
Do not insert a semicolon if the previous token was a binop or a question mark. Change-Id: Id2ee1d3cb57fa3fe20bfc0078d06f9e2619d88f1 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml47
-rw-r--r--tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml19
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp16
3 files changed, 82 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml
new file mode 100644
index 0000000000..b9a30ef8b5
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon1.qml
@@ -0,0 +1,47 @@
+import QtQuick 2.0
+
+QtObject {
+
+ // PLEASE NOTE: the function below is whitespace and newline sensitive,
+ // because that is what the test is all about.
+ //
+ // So: DO NOT REFORMAT THE CODE BELOW!
+
+ function code() {
+var x=0, y=0;
+var z=
+x
++
+++
+y
+
+//////////////////////////////////////////////////////////////////////////////
+if (false) {
+ ;
+}
+//////////////////////////////////////////////////////////////////////////////
+
+z=
+x
++ ++
+y
+
+//////////////////////////////////////////////////////////////////////////////
+if (false) {
+ ;
+}
+//////////////////////////////////////////////////////////////////////////////
+
+z=
+x
++ ++
+y
+
+//////////////////////////////////////////////////////////////////////////////
+if (false) {
+ ;
+}
+
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml
new file mode 100644
index 0000000000..717cdb5715
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/incrDecrSemicolon2.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+QtObject {
+
+ // PLEASE NOTE: the function below is whitespace and newline sensitive,
+ // because that is what the test is all about.
+ //
+ // So: DO NOT REFORMAT THE CODE BELOW!
+
+ function code() {
+var a, b, c;
+a=b
+++c
+
+if (a === b) {
+}
+ }
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index baee10055b..a1a51d4965 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -266,6 +266,8 @@ private slots:
void deleteLaterObjectMethodCall();
void automaticSemicolon();
void compatibilitySemicolon();
+ void incrDecrSemicolon1();
+ void incrDecrSemicolon2();
void unaryExpression();
void switchStatement();
void withStatement();
@@ -6627,6 +6629,20 @@ void tst_qqmlecmascript::compatibilitySemicolon()
QVERIFY(object != 0);
}
+void tst_qqmlecmascript::incrDecrSemicolon1()
+{
+ QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon1.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qqmlecmascript::incrDecrSemicolon2()
+{
+ QQmlComponent component(&engine, testFileUrl("incrDecrSemicolon2.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
void tst_qqmlecmascript::unaryExpression()
{
QQmlComponent component(&engine, testFileUrl("unaryExpression.qml"));