| 1 | fn try(this string) !bool { |
| 2 | return true |
| 3 | } |
| 4 | |
| 5 | fn test_case1() { |
| 6 | a, b := match true { |
| 7 | try('foo')! { 'a', 'b' } |
| 8 | try('bar')! { 'c', 'd' } |
| 9 | else { 'e', 'f' } |
| 10 | } |
| 11 | |
| 12 | assert a == 'a' |
| 13 | assert b == 'b' |
| 14 | } |
| 15 | |
| 16 | fn test_case2() { |
| 17 | a, b := match true { |
| 18 | try('foo')! && try('foo') or { false } { 'a', 'b' } |
| 19 | try('bar') or { false } { 'c', 'd' } |
| 20 | else { 'e', 'f' } |
| 21 | } |
| 22 | |
| 23 | assert a == 'a' |
| 24 | assert b == 'b' |
| 25 | } |
| 26 |