mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 16:21:11 +00:00
add more refcounting test cases
This commit is contained in:
parent
675e0693a4
commit
f4117c99d5
1 changed files with 43 additions and 1 deletions
|
@ -135,7 +135,7 @@ fn list_map() {
|
|||
List.map i1 Str.toUtf8
|
||||
"#
|
||||
),
|
||||
RocList<(RocStr, i64)>,
|
||||
RocList<RocStr>,
|
||||
&[
|
||||
(StandardRC, Live(3)), // s
|
||||
(AfterSize, Deallocated), // i1
|
||||
|
@ -144,6 +144,27 @@ fn list_map() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "gen-wasm")]
|
||||
fn list_map_dealloc() {
|
||||
assert_refcounts!(
|
||||
indoc!(
|
||||
r#"
|
||||
s = Str.concat "A long enough string " "to be heap-allocated"
|
||||
i1 = [s, s, s]
|
||||
List.map i1 Str.toUtf8
|
||||
|> List.len
|
||||
"#
|
||||
),
|
||||
i64,
|
||||
&[
|
||||
(StandardRC, Deallocated), // s
|
||||
(AfterSize, Deallocated), // i1
|
||||
(AfterSize, Deallocated), // Result
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "gen-wasm")]
|
||||
fn list_map2_dealloc_tail() {
|
||||
|
@ -166,6 +187,27 @@ fn list_map2_dealloc_tail() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "gen-wasm")]
|
||||
fn list_map2_dealloc() {
|
||||
assert_refcounts!(
|
||||
indoc!(
|
||||
r#"
|
||||
s = Str.concat "A long enough string " "to be heap-allocated"
|
||||
i1 = [s, s, s]
|
||||
List.map2 i1 i1 \a, b -> (a, b)
|
||||
|> List.len
|
||||
"#
|
||||
),
|
||||
i64,
|
||||
&[
|
||||
(StandardRC, Deallocated), // s
|
||||
(AfterSize, Deallocated), // i1
|
||||
(AfterSize, Deallocated), // Result
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(feature = "gen-wasm")]
|
||||
fn list_str_dealloc() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue