]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add "switch enum" test to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 31 Mar 2020 08:39:38 +0000 (10:39 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 20 Apr 2020 19:11:47 +0000 (21:11 +0200)
tests/Makefile.am
tests/enums/switch.vala [new file with mode: 0644]

index 150bf7fe2c389b9e9b036ec997e57237ca68576f..b823f6aea5503eff9a667057e1a870317d7ef632 100644 (file)
@@ -241,6 +241,7 @@ TESTS = \
        enums/flags.vala \
        enums/from-0-literal.vala \
        enums/no_gtype_to_string.vala \
+       enums/switch.vala \
        enums/bug666035.vala \
        enums/bug666035-1.test \
        enums/bug666035-2.test \
diff --git a/tests/enums/switch.vala b/tests/enums/switch.vala
new file mode 100644 (file)
index 0000000..031881b
--- /dev/null
@@ -0,0 +1,18 @@
+enum Foo {
+       BAR,
+       MANAM
+}
+
+void main () {
+       var foo = Foo.MANAM;
+
+       switch (foo) {
+       case Foo.BAR:
+               assert_not_reached ();
+               break;
+       case Foo.MANAM:
+               break;
+       default:
+               assert_not_reached ();
+       }
+}