implement when on multiple string patterns

This commit is contained in:
Folkert 2022-07-29 12:13:21 +02:00
parent d409e5f93c
commit d0f1500dad
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 103 additions and 6 deletions

View file

@ -3651,3 +3651,34 @@ fn promote_u128_number_layout() {
u128
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn when_on_decimals() {
assert_evals_to!(
indoc!(
r#"
when 42.42dec is
42.42 -> 42
0.05 -> 1
3.14 -> 2
_ -> 4
"#
),
42,
i64
);
assert_evals_to!(
indoc!(
r#"
when 42.42dec is
0.05 -> 1
3.14 -> 2
_ -> 4
"#
),
4,
i64
);
}