mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-14 15:55:02 +00:00
Use larger debug stack for abilities tests
This commit is contained in:
parent
5b0d47c9eb
commit
858fbba4e1
1 changed files with 89 additions and 77 deletions
|
@ -1060,23 +1060,27 @@ mod decode_immediate {
|
||||||
#[cfg(all(test, any(feature = "gen-llvm")))]
|
#[cfg(all(test, any(feature = "gen-llvm")))]
|
||||||
use roc_std::RocStr;
|
use roc_std::RocStr;
|
||||||
|
|
||||||
|
use crate::helpers::with_larger_debug_stack;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm"))]
|
||||||
fn string() {
|
fn string() {
|
||||||
assert_evals_to!(
|
with_larger_debug_stack(|| {
|
||||||
indoc!(
|
assert_evals_to!(
|
||||||
r#"
|
indoc!(
|
||||||
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
r#"
|
||||||
|
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
||||||
|
|
||||||
main =
|
main =
|
||||||
when Str.toUtf8 "\"foo\"" |> Decode.fromBytes TotallyNotJson.json is
|
when Str.toUtf8 "\"foo\"" |> Decode.fromBytes TotallyNotJson.json is
|
||||||
Ok s -> s
|
Ok s -> s
|
||||||
_ -> "<bad>"
|
_ -> "<bad>"
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
RocStr::from("foo"),
|
RocStr::from("foo"),
|
||||||
RocStr
|
RocStr
|
||||||
)
|
)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1183,59 +1187,65 @@ mod decode_immediate {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
fn decode_list_of_strings() {
|
fn decode_list_of_strings() {
|
||||||
assert_evals_to!(
|
with_larger_debug_stack(|| {
|
||||||
indoc!(
|
assert_evals_to!(
|
||||||
r#"
|
indoc!(
|
||||||
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
r#"
|
||||||
|
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
||||||
|
|
||||||
main =
|
main =
|
||||||
when Str.toUtf8 "[\"a\",\"b\",\"c\"]" |> Decode.fromBytes TotallyNotJson.json is
|
when Str.toUtf8 "[\"a\",\"b\",\"c\"]" |> Decode.fromBytes TotallyNotJson.json is
|
||||||
Ok l -> Str.joinWith l ","
|
Ok l -> Str.joinWith l ","
|
||||||
_ -> "<bad>"
|
_ -> "<bad>"
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
RocStr::from("a,b,c"),
|
RocStr::from("a,b,c"),
|
||||||
RocStr
|
RocStr
|
||||||
)
|
)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(all(any(feature = "gen-llvm", feature = "gen-wasm")))]
|
#[cfg(all(any(feature = "gen-llvm", feature = "gen-wasm")))]
|
||||||
fn encode_then_decode_list_of_strings() {
|
fn encode_then_decode_list_of_strings() {
|
||||||
assert_evals_to!(
|
with_larger_debug_stack(|| {
|
||||||
indoc!(
|
assert_evals_to!(
|
||||||
r#"
|
indoc!(
|
||||||
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
r#"
|
||||||
|
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
||||||
|
|
||||||
main =
|
main =
|
||||||
when Encode.toBytes ["a", "b", "c"] TotallyNotJson.json |> Decode.fromBytes TotallyNotJson.json is
|
when Encode.toBytes ["a", "b", "c"] TotallyNotJson.json |> Decode.fromBytes TotallyNotJson.json is
|
||||||
Ok l -> Str.joinWith l ","
|
Ok l -> Str.joinWith l ","
|
||||||
_ -> "something went wrong"
|
_ -> "something went wrong"
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
RocStr::from("a,b,c"),
|
RocStr::from("a,b,c"),
|
||||||
RocStr
|
RocStr
|
||||||
)
|
)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm"))]
|
#[cfg(any(feature = "gen-llvm"))]
|
||||||
#[ignore = "#3696: Currently hits some weird panic in borrow checking, not sure if it's directly related to abilities."]
|
#[ignore = "#3696: 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() {
|
fn encode_then_decode_list_of_lists_of_strings() {
|
||||||
assert_evals_to!(
|
with_larger_debug_stack(|| {
|
||||||
indoc!(
|
assert_evals_to!(
|
||||||
r#"
|
indoc!(
|
||||||
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
r#"
|
||||||
|
app "test" imports [TotallyNotJson] provides [main] to "./platform"
|
||||||
|
|
||||||
main =
|
main =
|
||||||
when Encode.toBytes [["a", "b"], ["c", "d", "e"], ["f"]] TotallyNotJson.json |> Decode.fromBytes TotallyNotJson.json is
|
when Encode.toBytes [["a", "b"], ["c", "d", "e"], ["f"]] TotallyNotJson.json |> Decode.fromBytes TotallyNotJson.json is
|
||||||
Ok list -> (List.map list \inner -> Str.joinWith inner ",") |> Str.joinWith l ";"
|
Ok list -> (List.map list \inner -> Str.joinWith inner ",") |> Str.joinWith l ";"
|
||||||
_ -> "something went wrong"
|
_ -> "something went wrong"
|
||||||
"#
|
"#
|
||||||
),
|
),
|
||||||
RocStr::from("a,b;c,d,e;f"),
|
RocStr::from("a,b;c,d,e;f"),
|
||||||
RocStr
|
RocStr
|
||||||
)
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -2139,32 +2149,34 @@ mod eq {
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||||
fn issue_4772_weakened_monomorphic_destructure() {
|
fn issue_4772_weakened_monomorphic_destructure() {
|
||||||
assert_evals_to!(
|
with_larger_debug_stack(|| {
|
||||||
indoc!(
|
assert_evals_to!(
|
||||||
r###"
|
indoc!(
|
||||||
app "test"
|
r###"
|
||||||
imports [TotallyNotJson]
|
app "test"
|
||||||
provides [main] to "./platform"
|
imports [TotallyNotJson]
|
||||||
|
provides [main] to "./platform"
|
||||||
|
|
||||||
getNumber =
|
getNumber =
|
||||||
{ result, rest } = Decode.fromBytesPartial (Str.toUtf8 "\"1234\"") TotallyNotJson.json
|
{ result, rest } = Decode.fromBytesPartial (Str.toUtf8 "\"1234\"") TotallyNotJson.json
|
||||||
|
|
||||||
when result is
|
when result is
|
||||||
Ok val ->
|
Ok val ->
|
||||||
when Str.toI64 val is
|
when Str.toI64 val is
|
||||||
Ok number ->
|
Ok number ->
|
||||||
Ok {val : number, input : rest}
|
Ok {val : number, input : rest}
|
||||||
Err InvalidNumStr ->
|
Err InvalidNumStr ->
|
||||||
Err (ParsingFailure "not a number")
|
Err (ParsingFailure "not a number")
|
||||||
|
|
||||||
Err _ ->
|
Err _ ->
|
||||||
Err (ParsingFailure "not a number")
|
Err (ParsingFailure "not a number")
|
||||||
|
|
||||||
main =
|
main =
|
||||||
getNumber |> Result.map .val |> Result.withDefault 0
|
getNumber |> Result.map .val |> Result.withDefault 0
|
||||||
"###
|
"###
|
||||||
),
|
),
|
||||||
1234i64,
|
1234i64,
|
||||||
i64
|
i64
|
||||||
);
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue