diff --git a/cmd/tools/vcreate/vcreate_input_test.v b/cmd/tools/vcreate/vcreate_input_test.v index 822638152af3a6..7bedc5bbabf71e 100644 --- a/cmd/tools/vcreate/vcreate_input_test.v +++ b/cmd/tools/vcreate/vcreate_input_test.v @@ -3,7 +3,7 @@ import v.vmod const ( // Expect has to be installed for the test. - expect_exe = os.quoted_path(os.find_abs_path_of_executable('expect') or { + expect_exe = os.quoted_path(os.find_abs_path_of_executable('expect') or { eprintln('skipping test, since expect is missing') exit(0) }) diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index a46524edc8e0be..ddbca8cc58e26b 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -788,7 +788,8 @@ fn expr_is_single_line(expr ast.Expr) bool { } } ast.CallExpr { - if expr.or_block.stmts.len > 1 { + if expr.or_block.stmts.len > 1 || expr.args.any(it.expr is ast.CallExpr + && it.expr.or_block.stmts.len > 1) { return false } } diff --git a/vlib/v/fmt/tests/consts_with_or_block_keep.vv b/vlib/v/fmt/tests/consts_with_or_block_keep.vv new file mode 100644 index 00000000000000..9327c47a0ba8c6 --- /dev/null +++ b/vlib/v/fmt/tests/consts_with_or_block_keep.vv @@ -0,0 +1,13 @@ +import os + +const ( + exe = os.find_abs_path_of_executable('my_exe') or { + eprintln('skipping test, since `my_exe` is missing') + exit(0) + } + exe_quoted = os.quoted_path(os.find_abs_path_of_executable('my_exe') or { + eprintln('skipping test, since `my_exe` is missing') + exit(0) + }) + single_line_test_path = os.join_path(os.vtmp_dir(), 'my_test_path') +)