Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
assign
/
assign_option_of_array_index_test.v
9
lines
·
8
sloc
·
213 bytes
·
89c3590765099e380f43d9d2b31b33abcf8ddc0e
Raw
1
fn
make_option() ?string {
2
return
none
3
}
4
5
fn
test_assign_option_of_array_index() {
6
arr := [make_option()]
7
unwrapped := arr[99]
or
{
'unknown'
}
// <- out of bounds access!
8
assert
'${unwrapped}'
==
'unknown'
9
}
10