mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
respect int/float precision in pattern matchs
This commit is contained in:
parent
cde9f97415
commit
ada331567a
4 changed files with 153 additions and 66 deletions
|
@ -1778,4 +1778,48 @@ mod gen_num {
|
|||
u32
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn when_on_i32() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [ main ] to "./platform"
|
||||
|
||||
x : I32
|
||||
x = 0
|
||||
|
||||
main : I32
|
||||
main =
|
||||
when x is
|
||||
0 -> 42
|
||||
_ -> -1
|
||||
"#
|
||||
),
|
||||
42,
|
||||
i32
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn when_on_i16() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [ main ] to "./platform"
|
||||
|
||||
x : I16
|
||||
x = 0
|
||||
|
||||
main : I16
|
||||
main =
|
||||
when x is
|
||||
0 -> 42
|
||||
_ -> -1
|
||||
"#
|
||||
),
|
||||
42,
|
||||
i16
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue