Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
conditions
/
matches
/
match_interface_test.v
22
lines
·
19
sloc
·
242 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
interface
Animal {
2
name string
3
}
4
5
struct
Dog {
6
name string
7
}
8
9
struct
Cat {
10
name string
11
}
12
13
fn
test_interface_match() {
14
a := Animal(Dog{
15
name:
'Jet'
16
})
17
match
a {
18
Dog { assert
true
}
19
Cat { assert
false
}
20
else
{ assert
false
}
21
}
22
}
23