Migrate a few more tests

This commit is contained in:
Ayaz Hafiz 2023-03-31 13:45:06 -05:00
parent 54d6bf7747
commit 3fc54ea578
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 24 additions and 76 deletions

View file

@ -8524,80 +8524,4 @@ mod solve_expr {
@"main : List w_a"
);
}
#[test]
fn recursive_closure_with_transiently_used_capture() {
infer_queries!(
indoc!(
r#"
app "test" provides [f] to "./platform"
thenDo = \x, callback ->
callback x
f = \{} ->
code = 10u16
bf = \{} ->
#^^{-1}
thenDo code \_ -> bf {}
# ^^^^^^^^^^^
bf {}
"#
),
@r###"
bf : {} -[[bf(5) U16]]-> *
\_ -> bf {} : U16 -[[6 U16]]-> *
"###
);
}
#[test]
fn derive_decoder_for_bool() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
main : Decoder Bool _
main = Decode.custom \bytes, fmt ->
Decode.decodeWith bytes Decode.decoder fmt
# ^^^^^^^^^^^^^^
"#
),
@"Decoding#Decode.decoder(4) : List U8, fmt -[[] + fmt:Decode.bool(19):1]-> { rest : List U8, result : [Err [TooShort], Ok [False, True]] } | fmt has DecoderFormatting"
print_only_under_alias: true
);
}
#[test]
fn derive_to_encoder_for_bool() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
main = Encode.toEncoder Bool.true
# ^^^^^^^^^^^^^^^^
"#
),
@"Encoding#Encode.toEncoder(2) : Bool -[[] + fmt:Encode.bool(17):1]-> Encoder fmt | fmt has EncoderFormatting"
);
}
#[test]
fn derive_eq_for_bool() {
infer_queries!(
indoc!(
r#"
app "test" provides [main] to "./platform"
main = Bool.isEq Bool.true Bool.false
# ^^^^^^^^^
"#
),
@"Eq#Bool.isEq(9) : Bool, Bool -[[Bool.structuralEq(11)]]-> Bool"
);
}
}

View file

@ -0,0 +1,14 @@
app "test" provides [f] to "./platform"
thenDo = \x, callback ->
callback x
f = \{} ->
code = 10u16
bf = \{} ->
#^^{-1} bf : {} -[[bf(5) U16]]-> *
thenDo code \_ -> bf {}
# ^^^^^^^^^^^ \_ -> bf {} : U16 -[[6 U16]]-> *
bf {}

View file

@ -0,0 +1,6 @@
app "test" provides [main] to "./platform"
main : Decoder Bool _
main = Decode.custom \bytes, fmt ->
Decode.decodeWith bytes Decode.decoder fmt
# ^^^^^^^^^^^^^^ Decoding#Decode.decoder(4) : Decoder Bool fmt | fmt has DecoderFormatting

View file

@ -0,0 +1,4 @@
app "test" provides [main] to "./platform"
main = Encode.toEncoder Bool.true
# ^^^^^^^^^^^^^^^^ Encoding#Encode.toEncoder(2) : Bool -[[] + fmt:Encode.bool(17):1]-> Encoder fmt | fmt has EncoderFormatting