v2 / vlib / v / tests / options / option_cast_eq_none_test.v
17 lines · 14 sloc · 265 bytes · 1275305c55e213c720b83b6c1cbe248b8cba255f
Raw
1struct Foo {
2 x int
3}
4
5fn test_option_cast_eq_none() {
6 assert ?int(none) == none
7 assert !(?int(123) == none)
8 assert ?int(123) != none
9
10 assert ?string(none) == none
11 assert ?string('hi') != none
12
13 assert ?Foo(none) == none
14 assert ?Foo(Foo{
15 x: 1
16 }) != none
17}
18