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() {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user