mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix array.index() of ref struct (#7652)
This commit is contained in:
@@ -1278,3 +1278,15 @@ fn test_array_struct_ref_contains() {
|
||||
println(exists)
|
||||
assert exists == true
|
||||
}
|
||||
|
||||
fn test_array_struct_ref_index() {
|
||||
mut coords := []&Coord{}
|
||||
coord_1 := &Coord{
|
||||
x: 1
|
||||
y: 2
|
||||
z: -1
|
||||
}
|
||||
coords << coord_1
|
||||
println(coords.index(coord_1))
|
||||
assert coords.index(coord_1) == 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user