v2 / vlib / v / tests / options / option_init_ptr_test.v
26 lines · 22 sloc · 241 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Abc {
2 a int
3}
4
5fn test_option_init() {
6 a := ?Abc{
7 a: 1
8 }
9 dump(a)
10 b := &?Abc{
11 a: 1
12 }
13 dump(b)
14
15 assert *b? == a?
16}
17
18fn test_option_empty() {
19 a := ?Abc{}
20 dump(a)
21 b := &?Abc{}
22 dump(b)
23
24 assert a == none
25 assert b == none
26}
27