Restore some more inference tests

This commit is contained in:
Richard Feldman 2019-10-01 21:12:07 +03:00
parent 4dddea0bb1
commit 4bcdf062e5

View file

@ -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