mirror of
https://github.com/vlang/v.git
synced 2025-09-16 07:52:32 +03:00
array: fix multiple array clone
This commit is contained in:
parent
8a5ca4cbdc
commit
dc8b82e9a4
2 changed files with 21 additions and 1 deletions
|
@ -361,6 +361,16 @@ fn test_clone() {
|
|||
assert nums.slice(1, 3).str() == '[2, 3]'
|
||||
}
|
||||
|
||||
fn test_mutli_array_clone() {
|
||||
mut array1 := [[1, 2, 3], [4, 5, 6]]
|
||||
mut array2 := array1.clone()
|
||||
|
||||
array1[0][1] = 0
|
||||
|
||||
assert array1 == [[1, 0, 3], [4, 5, 6]]
|
||||
assert array2 == [[1, 2, 3], [4, 5, 6]]
|
||||
}
|
||||
|
||||
fn test_doubling() {
|
||||
mut nums := [1, 2, 3, 4, 5]
|
||||
for i in 0..nums.len {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue