Skip to content

Commit

Permalink
Merge branch 'main' into rivet_fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
StunxFS authored Nov 20, 2023
2 parents 176e658 + 89a3aad commit 5f91474
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/valid/src/guard_expr.ri
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@ test "guard expression with mutable variable" {
@assert(val == 3);
val += 2;
@assert(val == 5);
} else {
@assert(false);
}
}

test "`if` expression with guard expression" {
if val := ret_none() {
@assert(val == 3);
} else {
@assert(false);
}

@assert(if val := ret_none() {
Expand All @@ -37,18 +41,24 @@ test "`if` expression with guard expression" {

if val := ret_err() {
@assert(val == 3);
} else {
@assert(false);
}
}

test "`while` expression with guard expression" {
while val := ret_none() {
@assert(val == 3);
break;
} else {
@assert(false);
}

while val := ret_none(); val == 3 {
@assert(val == 3);
break;
} else {
@assert(false);
}
}

Expand Down

0 comments on commit 5f91474

Please sign in to comment.