mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Restore some more inference tests
This commit is contained in:
parent
4dddea0bb1
commit
4bcdf062e5
1 changed files with 77 additions and 77 deletions
|
@ -316,7 +316,7 @@ mod test_infer {
|
||||||
fn def_empty_record() {
|
fn def_empty_record() {
|
||||||
infer_eq(
|
infer_eq(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"# reset indentation
|
||||||
foo = {}
|
foo = {}
|
||||||
|
|
||||||
foo
|
foo
|
||||||
|
@ -330,7 +330,7 @@ mod test_infer {
|
||||||
fn def_string() {
|
fn def_string() {
|
||||||
infer_eq(
|
infer_eq(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"# reset indentation
|
||||||
str = "thing"
|
str = "thing"
|
||||||
|
|
||||||
str
|
str
|
||||||
|
@ -340,69 +340,69 @@ mod test_infer {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn def_1_arg_closure() {
|
// fn def_1_arg_closure() {
|
||||||
infer_eq(
|
// infer_eq(
|
||||||
indoc!(
|
// indoc!(
|
||||||
r#"
|
// r#"# reset indentation
|
||||||
fn = \_ -> {}
|
// fn = \_ -> {}
|
||||||
|
|
||||||
fn
|
// fn
|
||||||
"#
|
// "#
|
||||||
),
|
// ),
|
||||||
"* -> {}",
|
// "* -> {}",
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn def_2_arg_closure() {
|
// fn def_2_arg_closure() {
|
||||||
infer_eq(
|
// infer_eq(
|
||||||
indoc!(
|
// indoc!(
|
||||||
r#"
|
// r#"# reset indentation
|
||||||
func = \_ _ -> 42
|
// func = \_ _ -> 42
|
||||||
|
|
||||||
func
|
// func
|
||||||
"#
|
// "#
|
||||||
),
|
// ),
|
||||||
"*, * -> Int",
|
// "*, * -> Int",
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn def_3_arg_closure() {
|
// fn def_3_arg_closure() {
|
||||||
infer_eq(
|
// infer_eq(
|
||||||
indoc!(
|
// indoc!(
|
||||||
r#"
|
// r#"# reset indentation
|
||||||
f = \_ _ _ -> "test!"
|
// f = \_ _ _ -> "test!"
|
||||||
|
|
||||||
f
|
// f
|
||||||
"#
|
// "#
|
||||||
),
|
// ),
|
||||||
"*, *, * -> Str",
|
// "*, *, * -> Str",
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn def_multiple_functions() {
|
// fn def_multiple_functions() {
|
||||||
infer_eq(
|
// infer_eq(
|
||||||
indoc!(
|
// indoc!(
|
||||||
r#"
|
// r#"# reset indentation
|
||||||
a = \_ _ _ -> "test!"
|
// a = \_ _ _ -> "test!"
|
||||||
|
|
||||||
b = a
|
// b = a
|
||||||
|
|
||||||
b
|
// b
|
||||||
"#
|
// "#
|
||||||
),
|
// ),
|
||||||
"*, *, * -> Str",
|
// "*, *, * -> Str",
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn def_multiple_strings() {
|
fn def_multiple_strings() {
|
||||||
infer_eq(
|
infer_eq(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"# reset indentation
|
||||||
a = "test!"
|
a = "test!"
|
||||||
|
|
||||||
b = a
|
b = a
|
||||||
|
@ -418,7 +418,7 @@ mod test_infer {
|
||||||
fn def_multiple_ints() {
|
fn def_multiple_ints() {
|
||||||
infer_eq(
|
infer_eq(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"# reset indentation
|
||||||
c = b
|
c = b
|
||||||
|
|
||||||
b = a
|
b = a
|
||||||
|
@ -434,33 +434,33 @@ mod test_infer {
|
||||||
|
|
||||||
// CALLING FUNCTIONS
|
// CALLING FUNCTIONS
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn call_returns_int() {
|
// fn call_returns_int() {
|
||||||
infer_eq(
|
// infer_eq(
|
||||||
indoc!(
|
// indoc!(
|
||||||
r#"
|
// r#"# reset indentation
|
||||||
alwaysFive = \_ -> 5
|
// alwaysFive = \_ -> 5
|
||||||
|
|
||||||
alwaysFive "stuff"
|
// alwaysFive "stuff"
|
||||||
"#
|
// "#
|
||||||
),
|
// ),
|
||||||
"Int",
|
// "Int",
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
#[test]
|
// #[test]
|
||||||
fn call_returns_list() {
|
// fn call_returns_list() {
|
||||||
infer_eq(
|
// infer_eq(
|
||||||
indoc!(
|
// indoc!(
|
||||||
r#"
|
// r#"# reset indentation
|
||||||
enlist = \val -> [ val ]
|
// enlist = \val -> [ val ]
|
||||||
|
|
||||||
enlist 5
|
// enlist 5
|
||||||
"#
|
// "#
|
||||||
),
|
// ),
|
||||||
"List Int",
|
// "List Int",
|
||||||
);
|
// );
|
||||||
}
|
// }
|
||||||
|
|
||||||
// TODO type annotations
|
// TODO type annotations
|
||||||
// TODO fix identity inference
|
// TODO fix identity inference
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue