mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Add a refcount test for recursive unions
This commit is contained in:
parent
e0d0e1884d
commit
94dea1df9f
1 changed files with 29 additions and 2 deletions
|
@ -153,7 +153,7 @@ fn struct_dealloc() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-wasm"))]
|
||||||
fn union_nonrec_inc() {
|
fn union_nonrecursive_inc() {
|
||||||
assert_refcounts!(
|
assert_refcounts!(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
|
@ -177,7 +177,7 @@ fn union_nonrec_inc() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(any(feature = "gen-wasm"))]
|
#[cfg(any(feature = "gen-wasm"))]
|
||||||
fn union_nonrec_dec() {
|
fn union_nonrecursive_dec() {
|
||||||
assert_refcounts!(
|
assert_refcounts!(
|
||||||
indoc!(
|
indoc!(
|
||||||
r#"
|
r#"
|
||||||
|
@ -197,3 +197,30 @@ fn union_nonrec_dec() {
|
||||||
&[1] // s
|
&[1] // s
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[cfg(any(feature = "gen-wasm"))]
|
||||||
|
fn union_recursive_inc() {
|
||||||
|
assert_refcounts!(
|
||||||
|
indoc!(
|
||||||
|
r#"
|
||||||
|
Expr : [ Sym Str, Add Expr Expr ]
|
||||||
|
|
||||||
|
s = Str.concat "heap_allocated_" "symbol_name"
|
||||||
|
|
||||||
|
e : Expr
|
||||||
|
e = Add (Sym s) (Sym s)
|
||||||
|
|
||||||
|
[e, e]
|
||||||
|
"#
|
||||||
|
),
|
||||||
|
RocStr,
|
||||||
|
&[
|
||||||
|
4, // s
|
||||||
|
1, // Sym
|
||||||
|
1, // Sym
|
||||||
|
2, // Add
|
||||||
|
1 // list
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue