add memory leak valgrind test for freeing boxes

This commit is contained in:
Brendan Hansknecht 2024-01-06 08:16:56 -08:00
parent f3abb3b466
commit ce6e0bec9f
No known key found for this signature in database
GPG key ID: 0EA784685083E75B

View file

@ -550,3 +550,29 @@ fn joinpoint_nullpointer() {
"#
));
}
#[test]
fn freeing_boxes() {
valgrind_test(indoc!(
r#"
(
# Without refcounted field
a : I32
a = 7
|> Box.box
|> Box.unbox
# With refcounted field
b : Str
b =
"Testing123. This will definitely be a large string that is on the heap."
|> Box.box
|> Box.unbox
a
|> Num.toStr
|> Str.concat b
)
"#
));
}