mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
add test case for List.map refcounting
This commit is contained in:
parent
94cb4fb8ff
commit
8137e8aa84
1 changed files with 20 additions and 0 deletions
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue