v2 / vlib / v / tests / consts / const_can_use_options_results_test.v
20 lines · 16 sloc · 239 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1const aaa = iopt()?
2const bbb = sopt()!
3
4fn iopt() ?int {
5 return 1234
6}
7
8fn sopt() !string {
9 return 'xyz'
10}
11
12fn test_iconsts_are_resolved() {
13 z := aaa
14 assert z == 1234
15}
16
17fn test_sconsts_are_resolved() {
18 z := bbb
19 assert z == 'xyz'
20}
21