v/vlib/v/tests/array_of_interfaces_equalit...

32 lines
379 B
V

interface IObject {
foo()
}
struct Foo {}
fn (f Foo) foo() {
}
struct Array {
mut:
array []IObject
}
fn (a Array) contains(x IObject) bool {
for element in a.array {
if element == x {
return true
}
}
return false
}
fn test_array_of_interfaces_equality() {
foo := Foo{}
mut ary := Array{}
ary.array << foo
ret := ary.contains(foo)
println(ret)
assert ret
}