]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
DON'T MERGE Add example AST test
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 9 Apr 2020 19:06:13 +0000 (21:06 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Thu, 9 Apr 2020 19:06:13 +0000 (21:06 +0200)
tests/Makefile.am
tests/ast/switch-statement.test [new file with mode: 0644]

index 083b320fb6b16af2af1a7c15ff15e8061c02d3cb..62c70ccfa3ee842ed1277581ea4554778c48b5f2 100644 (file)
@@ -637,6 +637,7 @@ TESTS = \
        scanner/string-escape-x-digit-length.test \
        scanner/string-escape-x-empty.test \
        scanner/string-escape-x.vala \
+       ast/switch-statement.test \
        parser/array-creation-invalid.test \
        parser/assignment.vala \
        parser/attribute-duplicate.test \
diff --git a/tests/ast/switch-statement.test b/tests/ast/switch-statement.test
new file mode 100644 (file)
index 0000000..cde411d
--- /dev/null
@@ -0,0 +1,36 @@
+AST
+
+Input:
+
+void case_with_list () {
+       int i = 1;
+       switch (i) {
+       case 0, 1, 2:
+               break;
+       default:
+               assert_not_reached ();
+       }
+}
+
+void main () {
+       case_with_list ();
+}
+
+Output:
+
+1.1 | 1.19 | ValaMethod
+1.24 | 9.1 | ValaBlock
+2.2 | 2.10 | ValaDeclarationStatement
+2.10 | 2.10 | ValaIntegerLiteral
+3.2 | 3.11 | ValaSwitchStatement
+3.10 | 3.10 | ValaMemberAccess
+4.7 | 4.7 | ValaIntegerLiteral
+4.10 | 4.10 | ValaIntegerLiteral
+4.13 | 4.13 | ValaIntegerLiteral
+5.3 | 5.7 | ValaBreakStatement
+7.3 | 7.23 | ValaExpressionStatement
+7.3 | 7.23 | ValaMethodCall
+11.1 | 11.9 | ValaMethod
+11.14 | 13.1 | ValaBlock
+12.2 | 12.18 | ValaExpressionStatement
+12.2 | 12.18 | ValaMethodCall