Add destructured inferred example

This commit is contained in:
Ayaz Hafiz 2022-08-16 14:55:47 -05:00
parent 4ba132f7d0
commit 0ddbc172d7
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -1030,6 +1030,26 @@ fn decode_record_two_fields_string_and_string_infer_local_var() {
)
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn decode_record_two_fields_string_and_string_infer_local_var_destructured() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Decode, Json] provides [main] to "./platform"
main =
decoded = Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes Json.fromUtf8
when decoded is
Ok {first, second} -> Str.concat first second
_ -> "something went wrong"
"#
),
RocStr::from("abcd"),
RocStr
)
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
#[ignore = "json parsing impl must be fixed first"]