1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/cast_to_interface_test.v
2021-01-31 19:24:33 +02:00

18 lines
219 B
V

struct Cat {
x int = 123
}
interface Adoptable {
}
fn test_casting_to_interface() {
cat := Cat{}
a := Adoptable(cat)
if a is Cat {
assert typeof(a).name == '&Cat'
assert a.x == 123
return
}
assert false
}