v2 / vlib / v / tests / fns / fn_call_mut_ref_args_test.v
23 lines · 20 sloc · 365 bytes · 1c2f1a35040752af8aea8daf8226bd231d3bca19
Raw
1@[heap]
2struct Client {
3mut:
4 next &Client = unsafe { nil }
5 prev &Client = unsafe { nil }
6}
7
8fn init_vm1(mut head &Client) {
9 for c := head; c; c = c.next {
10 }
11}
12
13fn init_vm2(mut head &Client) {
14 for c := head; c == unsafe { nil }; c = c.next {
15 }
16}
17
18fn test_fn_call_mut_ref_args() {
19 mut head := &Client{}
20 init_vm1(mut &head)
21 init_vm2(mut &head)
22 assert true
23}
24