v2 / vlib / v / tests / printing_c_structs / string_interpolation_test.c.v
26 lines · 22 sloc · 433 bytes · 185bbd0aa0b3910d1f118187399c8ee3a915258b
Raw
1#include "@VMODROOT/cstruct.h"
2
3const the_string = 'the string'
4
5pub struct C.Abc {
6 char_pointer_field &char
7}
8
9struct VStruct {
10 a_c_struct C.Abc
11}
12
13fn test_interpolation_of_v_structs_containing_c_structs() {
14 abc := C.Abc{
15 char_pointer_field: &char(the_string.str)
16 }
17 xxx := VStruct{
18 a_c_struct: abc
19 }
20 sxxx := xxx.str()
21 assert sxxx == 'VStruct{
22 a_c_struct: C.Abc{
23 char_pointer_field: &C"the string"
24 }
25}'
26}
27