fix incorrect element width used for List.append in dev backend

This commit is contained in:
Folkert 2024-01-28 00:03:51 +01:00
parent 685025a240
commit bd0cb6338e
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 29 additions and 1 deletions

View file

@ -821,6 +821,30 @@ fn list_append_longer_list() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_append_record() {
assert_evals_to!(
indoc!(
r#"
[
{ name: "foo", content: "cfoo" },
{ name: "bar", content: "cbar" },
{ name: "baz", content: "cbaz" },
]
|> List.append { name: "spam", content: "cspam" }
"#
),
RocList::from_slice(&[
(RocStr::from("cfoo"), RocStr::from("foo"),),
(RocStr::from("cbar"), RocStr::from("bar"),),
(RocStr::from("cbaz"), RocStr::from("baz"),),
(RocStr::from("cspam"), RocStr::from("spam"),),
]),
RocList<(RocStr, RocStr)>
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn list_prepend() {