From: Rico Tzschichholz Date: Thu, 9 Apr 2020 19:06:13 +0000 (+0200) Subject: DON'T MERGE Add example AST test X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ae5de971d6f90961287e15441a264236a3ebd98;p=thirdparty%2Fvala.git DON'T MERGE Add example AST test --- diff --git a/tests/Makefile.am b/tests/Makefile.am index 083b320fb..62c70ccfa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 000000000..cde411df8 --- /dev/null +++ b/tests/ast/switch-statement.test @@ -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