File tree Expand file tree Collapse file tree
VirtualMachine/Tests/EVIL.Ceres.LanguageTests/tests Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments