v2 / vlib / v / tests / reflection_attr_quotes_test.v
21 lines · 19 sloc · 697 bytes · 5dcfbf927b272bfcc843633363cc2b63638caad7
Raw
1import v.reflection as r
2
3struct MyParams {
4 p_fpga_ver string @[long: fp_ver; name: 'FPGA Version'; xdoc: 'String to use as simulated FPGA version in Version responses. Must be in the form "a.bb.cccc"']
5 p_cm_ver string @[long: cm_ver; name: 'CM Version'; xdoc: 'String to use as simulated CM version in Version responses. Must be in the form "a.bb.cccc"']
6}
7
8fn test_main() {
9 a := MyParams{}
10 t := r.type_of(a)
11 if t.sym.info is r.Struct {
12 assert t.sym.info.fields[0].attrs[2] == VAttribute{
13 name: 'xdoc'
14 has_arg: true
15 arg: 'String to use as simulated FPGA version in Version responses. Must be in the form "a.bb.cccc"'
16 kind: .string
17 }
18 } else {
19 assert false
20 }
21}
22