Check in gen tests that don't work yet

This commit is contained in:
Ayaz Hafiz 2022-08-12 15:25:24 -07:00
parent f95c5aee12
commit d01c5c83b7
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 51 additions and 3 deletions

View file

@ -41,9 +41,9 @@ impl FlatDecodable {
_ => Err(Underivable),
},
FlatType::Record(fields, ext) => {
check_empty_ext_var(subs, ext, |ext| {
matches!(ext, Content::Structure(FlatType::EmptyRecord))
})?;
//check_empty_ext_var(subs, ext, |ext| {
// matches!(ext, Content::Structure(FlatType::EmptyRecord))
//})?;
if subs
.get_subs_slice(fields.record_fields())

View file

@ -6158,8 +6158,14 @@ fn from_can_when<'a>(
// We can't know what to return!
return Stmt::RuntimeError("Hit a 0-branch when expression");
}
dbg!(&branches);
let opt_branches = to_opt_branches(env, procs, branches, exhaustive_mark, layout_cache);
dbg!(roc_types::subs::SubsFmtContent(
env.subs.get_content_without_compacting(cond_var),
env.subs
));
let cond_layout = return_on_layout_error!(
env,
layout_cache.from_var(env.arena, cond_var, env.subs),

View file

@ -952,3 +952,26 @@ fn encode_then_decode_list_of_lists_of_strings() {
RocStr
)
}
#[test]
#[cfg(all(
any(feature = "gen-llvm"), // currently fails on gen-wasm
not(feature = "gen-llvm-wasm") // hits a stack limit in wasm3
))]
#[ignore]
fn decode_record_two_fields() {
assert_evals_to!(
indoc!(
r#"
app "test" imports [Encode, Decode, Json] provides [main] to "./platform"
main =
when Str.toUtf8 "{\"first\":\"ab\",\"second\":\"cd\"}" |> Decode.fromBytes Json.fromUtf8 is
Ok { first, second } -> Str.concat first second
_ -> "something went wrong"
"#
),
RocStr::from("ab "),
RocStr
)
}

View file

@ -1922,3 +1922,22 @@ fn issue_3669() {
"#
)
}
#[mono_test]
#[ignore]
fn decode_record_two_fields() {
indoc!(
r#"
app "helloWorld"
imports [Decode, Json]
provides [main] to "./platform"
main =
when Str.toUtf8 "{\"first\":\"ab\",\"second\":[\"cd\",\"ef\"]}" |> Decode.decodeWith Decode.decoder Json.fromUtf8 is
{result, rest: _} ->
when result is
Ok { first, second } -> Str.concat first (Str.joinWith second ",")
Err _ -> "<bad>"
"#
)
}