mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: clone the strings correctly in array.push
This commit is contained in:
@ -1032,6 +1032,17 @@ fn test_direct_array_access_via_ptr() {
|
||||
}
|
||||
}
|
||||
|
||||
fn test_push_arr_string_free() {
|
||||
mut lines := ['hi']
|
||||
s := 'a' + 'b'
|
||||
lines << s
|
||||
s.free() // make sure the data in the array is valid after freeing the string
|
||||
println(lines)
|
||||
assert lines.len == 2
|
||||
assert lines[0] == 'hi'
|
||||
assert lines[1] == 'ab'
|
||||
}
|
||||
|
||||
const (
|
||||
grid_size_1 = 2
|
||||
grid_size_2 = 3
|
||||
|
Reference in New Issue
Block a user