Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
options
/
option_struct_init_with_opt_test.v
19
lines
·
17
sloc
·
197 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
struct
Foo {
2
x ?string
3
}
4
5
fn
test_main() {
6
x := ?string(
'hi'
)
7
foo := Foo{
8
x: x
9
}
10
assert foo.x? ==
'hi'
11
}
12
13
fn
test_none() {
14
x := ?string(
none
)
15
foo := Foo{
16
x: x
17
}
18
assert foo.x ==
none
19
}
20