Scaffold tests

This commit is contained in:
Ayaz Hafiz 2022-05-18 19:12:31 -04:00
parent bb0777c3c8
commit 0e63efdf09
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 110 additions and 0 deletions

View file

@ -6455,4 +6455,62 @@ mod solve_expr {
"Str", "Str",
) )
} }
#[test]
#[ignore]
fn encode_record() {
infer_queries(
indoc!(
r#"
app "test"
imports [ Encode.{ toEncoder } ]
provides [ main ] to "./platform"
main = toEncoder { a: "" }
# ^^^^^^^^^
"#
),
&[],
)
}
#[test]
#[ignore]
fn encode_record_with_nested_able_var() {
infer_queries(
indoc!(
r#"
app "test"
imports [ Encode.{ toEncoder, Encoding } ]
provides [ main ] to "./platform"
main : a -> _ | a has Encoding
main = \a -> toEncoder { a: a }
# ^^^^^^^^^
"#
),
&[],
)
}
#[test]
#[ignore]
fn encode_record_with_nested_custom_impl() {
infer_queries(
indoc!(
r#"
app "test"
imports [ Encode.{ toEncoder, Encoding, custom } ]
provides [ main ] to "./platform"
A := {}
toEncoder = \@A _ -> custom \b, _ -> b
main = toEncoder { a: @A {} }
# ^^^^^^^^^
"#
),
&[],
)
}
} }

View file

@ -10053,4 +10053,56 @@ All branches in an `if` must have the same type!
), ),
) )
} }
#[test]
#[ignore]
fn function_does_not_implement_encoding() {
new_report_problem_as(
"cycle_through_non_function",
indoc!(
r#"
Encode.toEncoder (\x -> x)
"#
),
indoc!(
r#"
"#
),
)
}
#[test]
#[ignore]
fn unbound_type_in_record_does_not_implement_encoding() {
new_report_problem_as(
"cycle_through_non_function",
indoc!(
r#"
\x -> Encode.toEncoder { x: x }
"#
),
indoc!(
r#"
"#
),
)
}
#[test]
#[ignore]
fn nested_opaque_does_not_implement_encoding() {
new_report_problem_as(
"cycle_through_non_function",
indoc!(
r#"
A := {}
Encode.toEncoder { x: @A {} }
"#
),
indoc!(
r#"
"#
),
)
}
} }