v2 / vlib / v / tests / options / option_expr_with_array_value_test.v
23 lines · 21 sloc · 338 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1struct Empty {
2 empty string
3}
4
5fn print_error() ?[]Empty {
6 mut test := []Empty{}
7 test << Empty{
8 empty: 'Test'
9 }
10 if test[0].empty != '' {
11 return none
12 }
13 return test
14}
15
16fn test_option_expr_with_array_value() {
17 test_error := print_error() or {
18 eprintln(err)
19 []Empty{}
20 }
21 println(test_error)
22 assert '${test_error}' == '[]'
23}
24