vlib: add mut for the first parameter of builtin.copy, arrays.copy and crypto (#13702)

This commit is contained in:
Nick Treleaven 2022-03-09 18:26:00 +00:00 committed by GitHub
parent 4c33003f86
commit 7231a3f135
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 84 additions and 88 deletions

View file

@ -268,16 +268,16 @@ fn test_rotate_left_string() {
fn test_copy() {
mut a := [1, 2, 3]
mut b := [4, 5, 6]
assert copy(b, a) == 3
assert copy(mut b, a) == 3
assert b == [1, 2, 3]
// check independent copies
b[0] = 99
assert a[0] == 1
// check longer src
b << 7
assert copy(a, b) == 3
assert copy(mut a, b) == 3
assert a == [99, 2, 3]
// check longer dst
assert copy(b, [8, 9]) == 2
assert copy(mut b, [8, 9]) == 2
assert b == [8, 9, 3, 7]
}