From 494f4fe9869bcb39b5fe840ac06ea62d400c6f33 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 24 May 2020 07:19:58 +0000 Subject: [PATCH] tests: valgrind: string.replace() --- vlib/v/tests/valgrind/1.vv | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/vlib/v/tests/valgrind/1.vv b/vlib/v/tests/valgrind/1.vv index 161c5b1c10..92dace75b7 100644 --- a/vlib/v/tests/valgrind/1.vv +++ b/vlib/v/tests/valgrind/1.vv @@ -16,12 +16,24 @@ fn foo() { //str_inter := 'hello, $name' // concatenated strings must be freed + + //nums.free() // this should result in a double free and a CI error } +fn str_replace() { + s := 'hello world' + r := s.replace('hello', 'hi') + cloned := s.replace('hello', 'hi').clone() + cloned2 := r.clone() + println(s) + println(r) +} + fn main() { println('start') foo() + str_replace() println('end') }