mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-20 15:27:45 +03:00
Add a couple tests that currently hit a compiler panic
This commit is contained in:
parent
1273a6ab0b
commit
24810ca778
@ -689,6 +689,31 @@ fn encode_derived_list_of_records() {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
#[ignore = "Currently hits some weird panic in borrow checking, not sure if it's directly related to abilities."]
|
||||
fn encode_derived_list_of_lists_of_strings() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test"
|
||||
imports [Encode.{ toEncoder }, Json]
|
||||
provides [main] to "./platform"
|
||||
|
||||
main =
|
||||
lst = [["a", "b"], ["c", "d", "e"], ["f"]]
|
||||
encoded = Encode.toBytes lst Json.toUtf8
|
||||
result = Str.fromUtf8 encoded
|
||||
when result is
|
||||
Ok s -> s
|
||||
_ -> "<bad>"
|
||||
"#
|
||||
),
|
||||
RocStr::from(r#"[["a","b"],["c","d","e"],["f"]]"#),
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(all(
|
||||
any(feature = "gen-llvm", feature = "gen-wasm"),
|
||||
@ -910,3 +935,23 @@ fn encode_then_decode_list_of_strings() {
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
#[ignore = "Currently hits some weird panic in borrow checking, not sure if it's directly related to abilities."]
|
||||
fn encode_then_decode_list_of_lists_of_strings() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" imports [Encode, Decode, Json] provides [main] to "./platform"
|
||||
|
||||
main =
|
||||
when Encode.toBytes [["a", "b"], ["c", "d", "e"], ["f"]] Json.fromUtf8 |> Decode.fromBytes Json.fromUtf8 is
|
||||
Ok list -> (List.map list \inner -> Str.joinWith inner ",") |> Str.joinWith l ";"
|
||||
_ -> "something went wrong"
|
||||
"#
|
||||
),
|
||||
RocStr::from("a,b;c,d,e;f"),
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user