Skip to content

Commit

Permalink
new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Nov 13, 2024
1 parent 0581ea7 commit 92be7d3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
14 changes: 14 additions & 0 deletions vlib/v/checker/or_block_assert_err.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
vlib/v/checker/or_block_assert_err.vv:7:23: error: last statement in the `or {}` block should be an expression of type `int` or exit parent scope
5 |
6 | fn main() {
7 | a := f() or { assert true }
| ~~~~~~
8 | dump(a)
9 | f() or { assert true }
vlib/v/checker/or_block_assert_err.vv:11:24: error: last statement in the `or {}` block should be an expression of type `int` or exit parent scope
9 | f() or { assert true }
10 |
11 | b := ff() or { assert true }
| ~~~~~~
12 | dump(b)
13 | ff() or { assert true }
17 changes: 17 additions & 0 deletions vlib/v/checker/or_block_assert_err.vv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
fn f() !int {
return error('')
}

fn ff() ?int {
return none
}

fn main() {
a := f() or { assert true }
dump(a)
f() or { assert true }

b := ff() or { assert true }
dump(b)
ff() or { assert true }
}

0 comments on commit 92be7d3

Please sign in to comment.