Migrate more tests

This commit is contained in:
Ayaz Hafiz 2023-03-31 14:06:49 -05:00
parent 834f4afe2c
commit d891dd829f
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
7 changed files with 47 additions and 105 deletions

View file

@ -8375,97 +8375,4 @@ mod solve_expr {
print_can_decls: true
);
}
#[test]
fn constrain_dbg_flex_var() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
polyDbg = \x ->
#^^^^^^^{-1}
dbg x
x
main = polyDbg ""
"#
),
@"polyDbg : a -[[polyDbg(1)]]-> a"
);
}
#[test]
fn pattern_as_uses_inferred_type() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
main = when A "foo" is
A _ as a -> a
# ^
b -> b
# ^
"#
),
@r###"
a : [A Str]w_a
b : [A Str]w_a
"###
);
}
#[test]
fn pattern_as_does_not_narrow() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
input : [A Str, B Str]
input = A "foo"
drop : a -> {}
drop = \_ -> {}
main = when input is
# ^^^^^
A _ as a -> drop a
# ^
B _ as b -> drop b
# ^
"#
),
@r###"
input : [A Str, B Str]
a : [A Str, B Str]
b : [A Str, B Str]
"###
);
}
#[test]
fn pattern_as_list() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
input : List Str
input = [ "foo", "bar" ]
main = when input is
# ^^^^^
[ _first, .. as rest ] -> 1 + List.len rest
# ^^^^
[] -> 0
"#
),
@r###"
input : List Str
rest : List Str
"###
);
}
}