[vala/0.48] tests: Add "switch enum" test to increase coverage



commit eb6a9c52454b134f1231e85c95f59f148e6cd128
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Mar 31 10:39:38 2020 +0200

    tests: Add "switch enum" test to increase coverage

 tests/Makefile.am       |  1 +
 tests/enums/switch.vala | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c7d6e4554..1f965e1b2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -250,6 +250,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
index 000000000..031881bd8
--- /dev/null
+++ b/tests/enums/switch.vala
@@ -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 ();
+       }
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]