v2 / vlib / v / tests / structs / free_method_test.v
27 lines · 23 sloc · 237 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1module main
2
3pub struct Opt {
4 test ?Test
5}
6
7pub struct Test {
8 a string
9 b string @[skip]
10 c ?map[string]f64
11 d ?[]string
12}
13
14fn test_main() {
15 t := Opt{
16 test: Test{
17 a: 'a'
18 b: 'b'
19 }
20 }
21
22 defer {
23 unsafe {
24 t.free()
25 }
26 }
27}
28