1
0
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:
joe-conigliaro 2020-07-06 23:39:51 +10:00
parent 659aa8db3c
commit 9a4d989188
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1

View File

@ -133,7 +133,6 @@ type Abc = int | string
fn test_string_cast_to_sumtype() {
a := Abc('test')
b := Abc(111)
match a {
int {
assert false
@ -142,6 +141,22 @@ fn test_string_cast_to_sumtype() {
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 {
int {
assert true
@ -150,4 +165,4 @@ fn test_string_cast_to_sumtype() {
assert false
}
}
}
}