Gitly
English
Русский
Español
日本語
中文
Português
Log in
Register
v2
/
vlib
/
v
/
tests
/
builtin_arrays
/
fixed_array_generic_ret_test.v
21
lines
·
16
sloc
·
257 bytes
·
6488041a749df9762348d019c4223908c476f2e2
Raw
1
fn
example[T]() ?T {
2
return
T{}
3
}
4
5
fn
test_option() {
6
dump(example[[1]int]())
7
8
a := example[[1]int]()
9
assert a? == [0]!
10
}
11
12
fn
example2[T]() !T {
13
return
T{}
14
}
15
16
fn
test_result() {
17
dump(example2[[1]int]()!)
18
19
a := example2[[1]int]()!
20
assert a == [0]!
21
}
22