Use Derived_synth for synthesizing implementations, and Derived_gen for codegen

This commit is contained in:
Ayaz Hafiz 2022-07-12 13:36:14 -04:00
parent 7c2e806a02
commit df9bcb1a0c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
16 changed files with 1543 additions and 628 deletions

View file

@ -1815,6 +1815,40 @@ fn encode_derived_record_one_field_string() {
)
}
#[mono_test]
fn encode_derived_record_two_field_strings() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes {a: "foo", b: "bar"} Json.format)
when result is
Ok s -> s
_ -> "<bad>"
"#
)
}
#[mono_test]
fn encode_derived_nested_record_string() {
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
provides [main] to "./platform"
main =
result = Str.fromUtf8 (Encode.toBytes {a: {b: "bar"}} Json.format)
when result is
Ok s -> s
_ -> "<bad>"
"#
)
}
#[mono_test]
#[ignore = "TODO make this work (one ULS var is missing)"]
fn encode_derived_tag_one_field_string() {