mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
fix memory leak in string trimming
This commit is contained in:
parent
2105a14e21
commit
165d4b3450
2 changed files with 48 additions and 10 deletions
|
@ -250,3 +250,31 @@ fn list_concat_empty_list_zero_sized_type() {
|
|||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn str_trim_right_capacity() {
|
||||
valgrind_test(indoc!(
|
||||
r#"
|
||||
(
|
||||
str = "a" |> Str.reserve 30
|
||||
out = str |> Str.trimRight
|
||||
|
||||
if out == "" then "A" else "B"
|
||||
)
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn str_trim_left_capacity() {
|
||||
valgrind_test(indoc!(
|
||||
r#"
|
||||
(
|
||||
str = " a" |> Str.reserve 30
|
||||
out = str |> Str.trimLeft
|
||||
|
||||
if out == "" then "A" else "B"
|
||||
)
|
||||
"#
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue