v2 / vlib / v / tests / options / option_anon_struct_test.v
23 lines · 21 sloc · 251 bytes · 1601de1b78a041d600bd8da66d1cb6eaef06d6ef
Raw
1struct Foo {
2 a ?struct {
3 name string
4 }
5}
6
7fn test_main() {
8 t := Foo{}
9 assert '${t}' == 'Foo{
10 a: Option(none)
11}'
12
13 t2 := Foo{
14 a: struct {
15 name: 'foo'
16 }
17 }
18 assert '${t2}' == "Foo{
19 a: Option(struct {
20 name: 'foo'
21 })
22}"
23}
24