Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
casts
/
cast_to_interface_test.v
17
lines
·
15
sloc
·
219 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
struct
Cat {
2
x int = 123
3
}
4
5
interface
Adoptable {
6
}
7
8
fn
test_casting_to_interface() {
9
cat := Cat{}
10
a := Adoptable(cat)
11
if
a is Cat {
12
assert typeof(a).name ==
'&Cat'
13
assert a.x == 123
14
return
15
}
16
assert
false
17
}
18