diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2019-03-29 14:27:14 +0100 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2020-04-27 10:36:00 +0200 |
commit | cd3ea493df12806b55a9725bf8714111f69b7c87 (patch) | |
tree | bad9e7909835d37d0a0f8ad4375ef502e9722f5a /tests/control-flow | |
parent | 5759b2b931cb599417a5194d1e6eab8272842da8 (diff) | |
download | vala-cd3ea493df12806b55a9725bf8714111f69b7c87.tar.gz |
vala: Check coverage of switch on enum-type and issue warnings if needed
See https://gitlab.gnome.org/GNOME/vala/issues/777
Diffstat (limited to 'tests/control-flow')
-rw-r--r-- | tests/control-flow/switch-enum.vala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/control-flow/switch-enum.vala b/tests/control-flow/switch-enum.vala new file mode 100644 index 000000000..fa6b39991 --- /dev/null +++ b/tests/control-flow/switch-enum.vala @@ -0,0 +1,21 @@ +enum Foo { + FOO, + BAR, + MANAM +} + +Foo foo () { + Foo foo = Foo.BAR; + + switch (foo) { + case Foo.FOO: + case Foo.BAR: + break; + } + + return foo; +} + +void main () { + assert (foo () == Foo.BAR); +} |