Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
generics
/
generics_array_drop_test.v
11
lines
·
10
sloc
·
188 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
fn
shift[T](
mut
a []T) T {
2
res := a.first()
3
a.drop(1)
4
return
res
5
}
6
7
fn
test_generic_array_drop() {
8
mut
a := [
'x'
,
'y'
]
9
assert shift(
mut
a) ==
'x'
// 'x'
10
assert a == [
'y'
]
// ['y']
11
}
12