v2 / vlib / v / tests / enums / enum_with_const_test.v
20 lines · 17 sloc · 202 bytes · 8e35f4d9848f7ad35d857a187dddbfd2eca5e19d
Raw
1enum Foo {
2 a = c
3 b = 1
4 c = 2
5}
6
7const c = 0
8
9fn test_enum_with_const() {
10 mut foo := Foo.c
11 foo = .a
12 ret := match foo {
13 .a { 'a' }
14 .b { 'b' }
15 .c { 'c' }
16 }
17
18 println(ret)
19 assert ret == 'a'
20}
21