v2 / vlib / v / tests / structs / empty_struct_compare_test.v
39 lines · 36 sloc · 690 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1type MyInt = int
2type MyOptInt = ?int
3type MyOptStr = ?string
4type MySumType = f64 | int | string
5
6struct Foo {
7 i int
8 i_opt ?int
9 arr []int
10 arr2 []int = [1, 2]
11 dec f64
12 dec_opt ?f64
13 dec_arr []f64
14 i_arr []int
15 str_arr []string
16 opt_int ?int
17 opt_int2 ?int = 3
18 myalias MyInt
19 myoptlias ?MyInt
20 myoptlias2 ?MyInt = MyInt(1)
21 myoptint MyOptInt
22 mysumtype MySumType
23 mysumtypeopt ?MySumType
24 str string
25 str2 string = 'b'
26 str_opt ?string
27 str_opt2 ?string = 'a'
28 str3 MyOptStr
29}
30
31struct Bar {
32pub:
33 foo ?Foo
34}
35
36fn test_main() {
37 m := Bar{}
38 assert m == Bar{}
39}
40