Skip to content

Commit 8d88dc9

Browse files
committed
add extra by-expr tests.
1 parent 9eed098 commit 8d88dc9

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

VirtualMachine/Tests/EVIL.Ceres.LanguageTests/tests/023_by_expr.vil

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,4 +283,30 @@ fn by_expression_qualifier_is_function_result {
283283
};
284284

285285
assert.equal(result, "match");
286+
}
287+
288+
#[test]
289+
fn by_expression_branch_is_expression {
290+
val result = by (1 + 2) {
291+
(1 + 2) -> "match",
292+
else: "no match"
293+
};
294+
295+
assert.equal(result, "match");
296+
}
297+
298+
#[test]
299+
fn by_expression_branch_is_function {
300+
loc fn test_qualifier_provider(arg) -> arg;
301+
loc fn test_branch_provider(arg) -> arg + 1;
302+
303+
val result = by test_qualifier_provider(1) {
304+
test_branch_provider(0) -> "match",
305+
test_branch_provider(1) -> "uhh...",
306+
test_branch_provider(2) -> "something is really wrong.",
307+
test_branch_provider(3) -> "no. really.",
308+
else: "no match"
309+
};
310+
311+
assert.equal(result, "match");
286312
}

0 commit comments

Comments
 (0)