v2 / vlib / v / tests / consts / const_reference_argument_test.v
9 lines · 8 sloc · 187 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1fn a_const_accepting_fn(x &int, const_x &int) int {
2 return *x + *const_x
3}
4
5fn test_fn_with_const_ref_param_can_be_called() {
6 a := 1
7 b := 2
8 assert a_const_accepting_fn(&a, &b) == 3
9}
10