fix dev-wasm ListGetUnsafe refcounting

This commit is contained in:
Brendan Hansknecht 2024-07-12 16:50:02 -07:00
parent 5d613cd5f5
commit 0d083bc192
No known key found for this signature in database
GPG key ID: 0EA784685083E75B
2 changed files with 20 additions and 7 deletions

View file

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