1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/v/tests/option_expr_with_array_value_test.v

24 lines
350 B
V

struct Empty {
empty string
}
fn print_error() ?[]Empty {
mut test := []Empty{}
test << Empty{
empty: 'Test'
}
if test[0].empty != '' {
return error('Not empty')
}
return test
}
fn test_option_expr_with_array_value() {
test_error := print_error() or {
eprintln(err)
[]Empty{}
}
println(test_error)
assert '$test_error' == '[]'
}