mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-13 09:49:11 +03:00
Add a test for big encoders enabled by disjoint specialization variables
This commit is contained in:
parent
7926499900
commit
fe864a445d
@ -684,3 +684,30 @@ fn encode_derived_list_of_records() {
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm"))]
|
||||
fn encode_derived_record_with_many_types() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test"
|
||||
imports [Encode.{ toEncoder }, Json]
|
||||
provides [main] to "./platform"
|
||||
|
||||
main =
|
||||
fresh : [Fresh Str, Rotten Str]
|
||||
fresh = Fresh "tomatoes"
|
||||
rcd = {actors: ["Idris Elba", "Mila Kunis"], year: 2004u16, rating: {average: 7u8, min: 1u8, max: 10u8, sentiment: fresh}}
|
||||
result = Str.fromUtf8 (Encode.toBytes rcd Json.toUtf8)
|
||||
when result is
|
||||
Ok s -> s
|
||||
_ -> "<bad>"
|
||||
"#
|
||||
),
|
||||
RocStr::from(
|
||||
r#"{"actors":["Idris Elba","Mila Kunis"],"rating":{"average":7,"max":10,"min":1,"sentiment":{"Fresh":["tomatoes"]}},"year":2004}"#
|
||||
),
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user