mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
add more tests
This commit is contained in:
parent
3901cedf62
commit
ac18da302c
1 changed files with 87 additions and 2 deletions
|
@ -2357,7 +2357,7 @@ mod test_uniq_solve {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn foobar() {
|
fn record_pattern_match_field() {
|
||||||
infer_eq(
|
infer_eq(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
|
@ -2371,6 +2371,91 @@ mod test_uniq_solve {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn int_addition_with_annotation() {
|
||||||
|
infer_eq(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
f : Int, Int -> Int
|
||||||
|
f = \a, b -> a + b
|
||||||
|
|
||||||
|
f
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
"Attr * (Attr * Int, Attr * Int -> Attr * Int)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn int_addition_without_annotation() {
|
||||||
|
infer_eq(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
f = \a, b -> a + b + 0x0
|
||||||
|
|
||||||
|
f
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
"Attr * (Attr a Int, Attr b Int -> Attr c Int)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn num_addition_with_annotation() {
|
||||||
|
infer_eq(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
f : Num a, Num a -> Num a
|
||||||
|
f = \a, b -> a + b
|
||||||
|
|
||||||
|
f
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
"Attr * (Attr b (Num (Attr b a)), Attr c (Num (Attr c a)) -> Attr d (Num (Attr d a)))",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn num_addition_without_annotation() {
|
||||||
|
infer_eq(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
f = \a, b -> a + b
|
||||||
|
|
||||||
|
f
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
"Attr * (Attr a (Num (Attr a b)), Attr c (Num (Attr c b)) -> Attr d (Num (Attr d b)))",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn num_abs_with_annotation() {
|
||||||
|
infer_eq(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
f : Num a -> Num a
|
||||||
|
f = \x -> Num.abs x
|
||||||
|
|
||||||
|
f
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
"Attr * (Attr b (Num (Attr b a)) -> Attr c (Num (Attr c a)))",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn num_abs_without_annotation() {
|
||||||
|
infer_eq(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
\x -> Num.abs x
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
"Attr * (Attr a (Num (Attr a b)) -> Attr c (Num (Attr c b)))",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn use_correct_ext_var() {
|
fn use_correct_ext_var() {
|
||||||
infer_eq(
|
infer_eq(
|
||||||
|
@ -2423,7 +2508,7 @@ mod test_uniq_solve {
|
||||||
, cameFrom : Map.Map position position
|
, cameFrom : Map.Map position position
|
||||||
}
|
}
|
||||||
|
|
||||||
cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]*
|
# cheapestOpen : (position -> Float), Model position -> Result position [ KeyNotFound ]*
|
||||||
cheapestOpen = \costFunction, model ->
|
cheapestOpen = \costFunction, model ->
|
||||||
|
|
||||||
folder = \position, resSmallestSoFar ->
|
folder = \position, resSmallestSoFar ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue