Add test for specializing newtype records uniquely

Closes #5252
This commit is contained in:
Ayaz Hafiz 2023-05-11 13:33:49 -05:00
parent a6b3656471
commit 1b9b6d89e4
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -932,6 +932,29 @@ fn encode_derived_generic_tag_with_different_field_types() {
) )
} }
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn specialize_unique_newtype_records() {
assert_evals_to!(
indoc!(
r#"
app "test"
imports [Encode, Json]
provides [main] to "./platform"
main =
when Str.fromUtf8 (Encode.toBytes {a: Bool.true} Json.toUtf8) is
Ok s -> when Str.fromUtf8 (Encode.toBytes {b: Bool.true} Json.toUtf8) is
Ok t -> "\(s)\(t)"
_ -> "<bad>"
_ -> "<bad>"
"#
),
RocStr::from(r#"{"a":true}{"b":true}"#),
RocStr
)
}
#[test] #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
fn decode_use_stdlib() { fn decode_use_stdlib() {