v2 / vlib / v / tests / pointers / multi_ref_call_arg_test.v
24 lines · 21 sloc · 318 bytes · 6ba0b38f4b9a163297514ff1acec7e66078dede1
Raw
1fn takes_quad_ref(x &&&&int) {
2 unsafe {
3 ****x = 5
4 }
5}
6
7fn takes_triple_ref(x &&&int) {
8 unsafe {
9 ***x = 7
10 }
11}
12
13fn test_call_arg_with_multi_ref_from_value() {
14 mut y := 4
15 takes_quad_ref(y)
16 assert y == 5
17}
18
19fn test_call_arg_with_multi_ref_from_ref() {
20 mut y := 4
21 p := &y
22 takes_triple_ref(p)
23 assert y == 7
24}
25