aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qmldom/domdata/domitem/switchStatement.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qmldom/domdata/domitem/switchStatement.qml')
-rw-r--r--tests/auto/qmldom/domdata/domitem/switchStatement.qml28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qmldom/domdata/domitem/switchStatement.qml b/tests/auto/qmldom/domdata/domitem/switchStatement.qml
new file mode 100644
index 0000000000..b2bacec8c0
--- /dev/null
+++ b/tests/auto/qmldom/domdata/domitem/switchStatement.qml
@@ -0,0 +1,28 @@
+// Copyright (C) 2023 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+import QtQml
+
+QtObject {
+ function switchStatement(){
+ const animals = "cat";
+ const no = 0;
+ switch (animals) {
+ case "cat":
+ switch (no) {
+ case 0: return "patron";
+ case 1: return "mafik";
+ default: return "none";
+ }
+ case "dog": {
+ // check if qqmljsscope is created for this case
+ const name = "tekila";
+ let another = "mutantx";
+ return name;
+ }
+ default: return "monster";
+ case "moreCases!":
+ return "moreCaseClauses?"
+ }
+ }
+}