mirror of
https://github.com/vlang/v.git
synced 2025-09-16 16:02:29 +03:00
parent
f72f1fc893
commit
abd2b64700
1 changed files with 18 additions and 0 deletions
18
vlib/v/tests/as_cast_selector_test.v
Normal file
18
vlib/v/tests/as_cast_selector_test.v
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
struct Foo {
|
||||||
|
mut:
|
||||||
|
x int
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Bar {
|
||||||
|
mut:
|
||||||
|
y int
|
||||||
|
}
|
||||||
|
|
||||||
|
type Foobar = Bar | Foo
|
||||||
|
|
||||||
|
fn test_main() {
|
||||||
|
mut bar := Foobar(Bar{
|
||||||
|
y: 123
|
||||||
|
})
|
||||||
|
assert bar as Bar.y == 123
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue