Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
builtin_arrays
/
array_slice_assign_test.v
12
lines
·
9
sloc
·
208 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
fn
test_array_slice_assign() {
2
xs := [1, 2, 3, 4, 5, 6, 7, 8]
3
4
mut
s := xs[1..].clone()
5
6
s.sort(a > b)
7
8
println(s)
9
assert s == [8, 7, 6, 5, 4, 3, 2]
10
println(xs)
11
assert xs == [1, 2, 3, 4, 5, 6, 7, 8]
12
}
13