v2 / vlib / v / tests / c_structs / cstruct_test.c.v
17 lines · 13 sloc · 244 bytes · 8e9ddb13eae9cf258284cfde3ad928350d157942
Raw
1#include "@VMODROOT/cstruct.h"
2
3const the_string = 'the string'
4
5pub struct C.Abc {
6 field int
7}
8
9fn (a &C.Abc) str() string {
10 return 'C.Abc{}'
11}
12
13fn test_cstruct() {
14 x := unsafe { &C.Abc(1) }
15 println(x)
16 assert dump(x.str()) == 'C.Abc{}'
17}
18