mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
25 lines
239 B
V
25 lines
239 B
V
enum Foo {
|
|
a
|
|
b
|
|
c
|
|
}
|
|
|
|
fn get() Foo {
|
|
return .a
|
|
}
|
|
|
|
fn foo(f Foo) string {
|
|
println(f)
|
|
return '${f}'
|
|
}
|
|
|
|
fn test_match_expr_with_enum() {
|
|
ret := foo(match get() {
|
|
.a { .b }
|
|
.b { .c }
|
|
.c { .a }
|
|
})
|
|
println(ret)
|
|
assert ret == 'b'
|
|
}
|