1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

cgen: fix in array_of_ref_structs (fix #7623) (#7640)

This commit is contained in:
yuyi
2020-12-28 18:29:56 +08:00
committed by GitHub
parent 07459a77e3
commit d46b930c71
2 changed files with 29 additions and 23 deletions

View File

@@ -1251,7 +1251,7 @@ struct Coord {
z int
}
fn test__array_struct_contains() {
fn test_array_struct_contains() {
mut coords := []Coord{}
coord_1 := Coord{
x: 1
@@ -1265,3 +1265,16 @@ fn test__array_struct_contains() {
assert exists == true
assert not_exists == false
}
fn test_array_struct_ref_contains() {
mut coords := []&Coord{}
coord_1 := &Coord{
x: 1
y: 2
z: -1
}
coords << coord_1
exists := coord_1 in coords
println(exists)
assert exists == true
}