use capacity instead of length in list deinit

This commit is contained in:
Folkert 2023-01-16 21:26:35 +01:00
parent b8a6e05ed9
commit 4e5b106f98
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 40 additions and 9 deletions

View file

@ -193,6 +193,22 @@ fn list_concat_consumes_first_argument() {
valgrind_test("List.concat (List.withCapacity 1024) [1,2,3] |> List.len |> Num.toStr");
}
#[test]
fn list_concat_consumes_second_argument() {
valgrind_test(indoc!(
r#"
(
a : List U8
a = []
b = List.reserve [] 11
List.concat a b
|> List.len
|> Num.toStr
)
"#
));
}
#[test]
fn str_capacity_concat() {
valgrind_test(r#"Str.withCapacity 42 |> Str.concat "foobar""#);