Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
structs
/
struct_option_field_zero_test.v
21
lines
·
19
sloc
·
252 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
struct
Foo {
2
foo ?string
3
}
4
5
fn
test_struct_option_field_zero() {
6
a := Foo{}
7
if
foo := a.foo {
8
println(foo)
9
assert
false
10
}
else
{
11
assert
true
12
}
13
14
b := Foo{
'hello'
}
15
if
foo := b.foo {
16
println(foo)
17
assert
true
18
}
else
{
19
assert
false
20
}
21
}
22