add test case for List.map refcounting

This commit is contained in:
Brendan Hansknecht 2024-07-11 18:12:26 -07:00
parent 94cb4fb8ff
commit 8137e8aa84
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -124,6 +124,26 @@ fn list_str_slice() {
);
}
#[test]
#[cfg(feature = "gen-wasm")]
fn list_map() {
assert_refcounts!(
indoc!(
r#"
s = Str.concat "A long enough string " "to be heap-allocated"
i1 = [s, s, s]
List.map i1 Str.toUtf8
"#
),
RocList<(RocStr, i64)>,
&[
(StandardRC, Live(3)), // s
(AfterSize, Deallocated), // i1
(AfterSize, Live(1)), // Result
]
);
}
#[test]
#[cfg(feature = "gen-wasm")]
fn list_map2_dealloc_tail() {