summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2022-08-15 08:36:49 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2022-08-15 09:23:00 +0200
commit9a35167f7091a4a18900c07f75ab6fe3db8ae959 (patch)
tree0c932bd78f0801a6c614141891c09e0b88b3fa91 /tests
parentedd33896e11ee319e82b7678464b249942f9dbfc (diff)
downloadvala-9a35167f7091a4a18900c07f75ab6fe3db8ae959.tar.gz
vala: Make try-statement parsing more resilient
Regression of f5934184d050d1a19f394fdab6f2ee66ff30965f Fixes https://gitlab.gnome.org/GNOME/vala/issues/1304
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/parser/try-catch-in-switch-case-invalid.test16
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f5e0cb8ff..147c66676 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -994,6 +994,7 @@ TESTS = \
parser/switch-statement.vala \
parser/switch-section-outside-switch.test \
parser/template.vala \
+ parser/try-catch-in-switch-case-invalid.test \
parser/tuple.vala \
parser/unsupported-property-async.test \
parser/unsupported-property-throws.test \
diff --git a/tests/parser/try-catch-in-switch-case-invalid.test b/tests/parser/try-catch-in-switch-case-invalid.test
new file mode 100644
index 000000000..1d67e569c
--- /dev/null
+++ b/tests/parser/try-catch-in-switch-case-invalid.test
@@ -0,0 +1,16 @@
+Invalid Code
+
+void main () {
+ switch (42) {
+ case 42:
+ try {
+ GLib.print ("42");
+ catch (GLib.Error e) {
+ debug ("foo");
+ }
+ break;
+ default:
+ debug ("bar");
+ break;
+ }
+}