mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Migrate a few more tests
This commit is contained in:
parent
54d6bf7747
commit
3fc54ea578
4 changed files with 24 additions and 76 deletions
|
@ -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"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {}
|
|
@ -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
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue