From 7927e16613209e0723ecf23249b4357ffc6e9be8 Mon Sep 17 00:00:00 2001 From: yuyi Date: Fri, 21 Jun 2024 22:56:41 +0800 Subject: [PATCH] fmt: add fn_with_mut_ref_params_keep.vv --- vlib/v/fmt/tests/fn_with_mut_ref_params_keep.vv | 11 +++++++++++ vlib/v/tests/in_expression_test.v | 2 -- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 vlib/v/fmt/tests/fn_with_mut_ref_params_keep.vv diff --git a/vlib/v/fmt/tests/fn_with_mut_ref_params_keep.vv b/vlib/v/fmt/tests/fn_with_mut_ref_params_keep.vv new file mode 100644 index 00000000000000..55a5f93fbd4a46 --- /dev/null +++ b/vlib/v/fmt/tests/fn_with_mut_ref_params_keep.vv @@ -0,0 +1,11 @@ +struct Bar {} + +fn in_both_mut_ref(mut arr []&Bar, mut bar &Bar) { + assert bar !in arr +} + +fn main() { + mut arr := []&Bar{} + mut bar := Bar{} + in_both_mut_ref(mut &arr, mut &bar) +} diff --git a/vlib/v/tests/in_expression_test.v b/vlib/v/tests/in_expression_test.v index 97fc0312ccf763..70fc2e99fb2bf8 100644 --- a/vlib/v/tests/in_expression_test.v +++ b/vlib/v/tests/in_expression_test.v @@ -331,7 +331,6 @@ fn test_in_array_of_sumtype() { // for issue 20268 struct Bar {} -// vfmt off fn in_both_mut_ref(mut arr []&Bar, mut bar &Bar) { assert bar !in arr } @@ -341,4 +340,3 @@ fn test_in_both_mut_and_ref() { mut bar := Bar{} in_both_mut_ref(mut &arr, mut &bar) } -// vfmt on