v2 / vlib / v / checker / tests / run / using_comptime_d_value.vv
22 lines · 19 sloc · 604 bytes · 93d3278a5a8f0105ea9b289d1c7426f31ad357b6
Raw
1// spaces before the second argument, should not affect the outcome of parsing the $d() directive:
2#flag -I $d('my_flag','flag_value')/xyz
3#flag -I $d('my_flag', 'flag_value')/xyz
4#flag -I $d('my_flag', 'flag_value')/xyz
5#include "@VMODROOT/$d('my_include','vlib/v')/tests/project_with_c_code/mod1/c/header.h"
6
7const my_f64 = $d('my_f64', 42.0)
8
9struct StructFSAWithDSize {
10 fsa [$d('field_fsa_size', 10)]int
11}
12
13fn main() {
14 println(my_f64)
15 cv_bool := $d('my_bool', false)
16 println(cv_bool)
17 println('done')
18 fsa := [$d('fixed_size', 4)]int{}
19 println(fsa)
20 s := StructFSAWithDSize{}
21 println(s.fsa)
22}
23