v/vlib/v/tests/assert_sumtype_test.v

12 lines
144 B
V

struct Moon {}
struct Mars {}
type World = Mars | Moon
fn test_assert_sumtype() {
w := World(Moon{})
assert w is Moon
assert w !is Mars
}