mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
test: move sumtype int cast test into fn & test var
This commit is contained in:
parent
659aa8db3c
commit
9a4d989188
@ -133,7 +133,6 @@ type Abc = int | string
|
|||||||
|
|
||||||
fn test_string_cast_to_sumtype() {
|
fn test_string_cast_to_sumtype() {
|
||||||
a := Abc('test')
|
a := Abc('test')
|
||||||
b := Abc(111)
|
|
||||||
match a {
|
match a {
|
||||||
int {
|
int {
|
||||||
assert false
|
assert false
|
||||||
@ -142,6 +141,22 @@ fn test_string_cast_to_sumtype() {
|
|||||||
assert true
|
assert true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_int_cast_to_sumtype() {
|
||||||
|
// literal
|
||||||
|
a := Abc(111)
|
||||||
|
match a {
|
||||||
|
int {
|
||||||
|
assert true
|
||||||
|
}
|
||||||
|
string {
|
||||||
|
assert false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// var
|
||||||
|
i := 111
|
||||||
|
b := Abc(i)
|
||||||
match b {
|
match b {
|
||||||
int {
|
int {
|
||||||
assert true
|
assert true
|
||||||
|
Loading…
Reference in New Issue
Block a user