v2 / vlib / v / tests / conditions / matches / match_interface_test.v
22 lines · 19 sloc · 242 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1interface Animal {
2 name string
3}
4
5struct Dog {
6 name string
7}
8
9struct Cat {
10 name string
11}
12
13fn 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