aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmlls/utils/data/completions/switchStatements.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmlls/utils/data/completions/switchStatements.qml')
-rw-r--r--tests/auto/qmlls/utils/data/completions/switchStatements.qml37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qmlls/utils/data/completions/switchStatements.qml b/tests/auto/qmlls/utils/data/completions/switchStatements.qml
new file mode 100644
index 0000000000..f9ddf3f2a1
--- /dev/null
+++ b/tests/auto/qmlls/utils/data/completions/switchStatements.qml
@@ -0,0 +1,37 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQuick
+
+Item {
+ property int myProperty;
+ function g(x) { return x + 1; }
+ function f(x) {
+ switch(x) {
+
+ case 1:
+ return 0;
+ case g(x) + 3: {
+ return 1;
+ }
+ }
+
+ switch(x) {
+ case 42:
+ myProperty = x + f(x)
+ myProperty = myProperty * 0.33
+ default:
+ return 123456
+ case 666:
+ for(;;) {
+ g(x)
+ }
+ myProperty = "hello"
+ }
+ switch(x) {
+ default:
+ break;
+ }
+ }
+
+}