v2 / vlib / v / tests / comptime / comptime_call_tmpl_variable_scope_test.v
14 lines · 13 sloc · 348 bytes · d1e96eff8f3dafee3b7cf986be216542b1226f92
Raw
1@[heap]
2struct MyHeapStruct {
3 name string
4}
5
6// make sure dereferencing of heap structs works in selector expr (in tmpl),
7fn test_heap_struct_dereferencing_in_selector_expr() {
8 a := MyHeapStruct{
9 name: 'my_heap_struct_a'
10 }
11 b := 2
12 out := $tmpl('comptime_call_tmpl_variable_scope_test.tpl')
13 assert out.trim_space() == 'my_heap_struct_a\n2'
14}
15