v2 / vlib / v / tests / aliases / alias_compare_non_alias_test.v
21 lines · 17 sloc · 393 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Foo {
2 name string
3}
4
5type Foo1 = [2][2]int
6type Foo2 = []int
7type Foo3 = Foo
8
9fn test_alias_compare_non_alias_value() {
10 f1 := Foo1([[1, 2]!, [3, 4]!]!)
11 assert f1 == [[1, 2]!, [3, 4]!]!
12 assert [[1, 2]!, [3, 4]!]! == f1
13
14 f2 := Foo2([1, 2, 3, 4])
15 assert f2 == [1, 2, 3, 4]
16 assert [1, 2, 3, 4] == f2
17
18 f3 := Foo3(Foo{'hello'})
19 assert f3 == Foo{'hello'}
20 assert Foo{'hello'} == f3
21}
22