v2 / vlib / v / tests / options / option_concat_str_test.v
16 lines · 14 sloc · 243 bytes · 8e35f4d9848f7ad35d857a187dddbfd2eca5e19d
Raw
1fn test_str_concat() {
2 opt := ?string(none)
3 x := match 1 {
4 0 { 'abc' }
5 else { 'def' }
6 } + opt or { '!!!' }
7 assert x == 'def!!!'
8
9 y := opt or { '!!!' } + match 1 {
10 0 { 'abc' }
11 else { 'def' }
12 }
13
14 println(y)
15 assert y == '!!!def'
16}
17