aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/data
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmllanguage/data')
-rw-r--r--tests/auto/qml/qqmllanguage/data/listContainingDeleted.qml36
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.qml8
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.qml8
9 files changed, 72 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/listContainingDeleted.qml b/tests/auto/qml/qqmllanguage/data/listContainingDeleted.qml
new file mode 100644
index 0000000000..efd273ddc6
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/listContainingDeleted.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.12
+
+Item {
+ width: 1024
+ height: 800
+
+ property Component a: Component {
+ id: a
+ Item {
+ property list<QtObject> myList: [
+ QtObject {
+ property bool enabled: true
+ }
+ ]
+ }
+ }
+ Component {
+ id: b
+ Item {
+ property list<QtObject> myList
+
+ function test() {
+ for (var i = 0; i < myList.length; ++i)
+ console.log(i, "==", myList[i].enabled)
+ }
+ }
+ }
+ property Item instance
+ function doAssign(o) {
+ instance = b.createObject(null, {myList: o.myList})
+ }
+ function use() {
+ instance.test()
+ }
+
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.errors.txt b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.errors.txt
new file mode 100644
index 0000000000..d4f3eb3ecf
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.errors.txt
@@ -0,0 +1 @@
+6:29:Left-hand side may not contain || or &&
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.qml b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.qml
new file mode 100644
index 0000000000..ce6aa9a532
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_And.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Component {
+ Component.onCompleted: {
+ // Should cause an error since having either || or && on any side of the coalescing operator is banned by the specification
+ var bad_lhs_and = 3 && 4 ?? 0;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.errors.txt b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.errors.txt
new file mode 100644
index 0000000000..f2f1719acd
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.errors.txt
@@ -0,0 +1 @@
+6:28:Left-hand side may not contain || or &&
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.qml b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.qml
new file mode 100644
index 0000000000..8864524d0d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_LHS_Or.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Component {
+ Component.onCompleted: {
+ // Should cause an error since having either || or && on any side of the coalescing operator is banned by the specification
+ var bad_lhs_or = 3 || 4 ?? 0;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.errors.txt b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.errors.txt
new file mode 100644
index 0000000000..0ff61be687
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.errors.txt
@@ -0,0 +1 @@
+6:34:Right-hand side may not contain || or &&
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.qml b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.qml
new file mode 100644
index 0000000000..97898f055a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_And.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Component {
+ Component.onCompleted: {
+ // Should cause an error since having either || or && on any side of the coalescing operator is banned by the specification
+ var bad_rhs_and = 0 ?? 3 && 4;
+ }
+}
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.errors.txt b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.errors.txt
new file mode 100644
index 0000000000..4b2784ac0a
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.errors.txt
@@ -0,0 +1 @@
+6:33:Right-hand side may not contain || or &&
diff --git a/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.qml b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.qml
new file mode 100644
index 0000000000..f172755e91
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/nullishCoalescing_RHS_Or.qml
@@ -0,0 +1,8 @@
+import QtQuick 2.0
+
+Component {
+ Component.onCompleted: {
+ // Should cause an error since having either || or && on any side of the coalescing operator is banned by the specification
+ var bad_rhs_or = 0 ?? 3 || 4;
+ }
+}