mirror of
https://github.com/vlang/v.git
synced 2025-09-15 15:32:27 +03:00
cgen: fix array.index()
of ref struct (#7652)
This commit is contained in:
parent
93262353d6
commit
9631eac9c5
2 changed files with 43 additions and 38 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue