Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
conditions
/
ifs
/
if_expr_with_enum_test.v
19
lines
·
16
sloc
·
220 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
enum
Foo {
2
a
3
b
4
}
5
6
fn
get() Foo {
7
return
.a
8
}
9
10
fn
foo(f Foo) string {
11
println(f)
12
return
'${f}'
13
}
14
15
fn
test_if_expr_with_enum_value() {
16
ret := foo(
if
get() == .a { .b }
else
{ .a })
17
println(ret)
18
assert ret ==
'b'
19
}
20