1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
Files
v/vlib/v/tests/optional_assign_test.v
2021-04-02 16:34:48 +02:00

26 lines
404 B
V

type Foo = int | string
fn test_optional_none_assign() {
x := ?Foo(none)
// assert x.err == none
// assert !x.has_value
}
fn test_optional_none_assign_nonsumtype() {
x := ?int(none)
// assert x.err == none
// assert !x.has_value
}
// TODO: make this working next
/*
fn test_optional_value_assign() {
x := ?Foo('test')
}
fn test_optional_none_reassign() {
mut x := ?Foo('test')
x = none
}
*/