From 6c24e9ba8424221a39f0872a8b3740ea9c34d06a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=A4schle?= Date: Thu, 21 Jan 2021 14:48:57 +0100 Subject: [PATCH] tests: automatically add an .out file if not found, with VAUTOFIX=1 (#8250) --- vlib/v/compiler_errors_test.v | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vlib/v/compiler_errors_test.v b/vlib/v/compiler_errors_test.v index df679035e5..6c9977850a 100644 --- a/vlib/v/compiler_errors_test.v +++ b/vlib/v/compiler_errors_test.v @@ -175,6 +175,9 @@ fn (mut task TaskDescription) execute() { cli_cmd := '$task.vexe $task.voptions $program' res := os.exec(cli_cmd) or { panic(err) } expected_out_path := program.replace('.vv', '') + task.result_extension + if should_autofix && !os.exists(expected_out_path) { + os.write_file(expected_out_path, '') + } mut expected := os.read_file(expected_out_path) or { panic(err) } task.expected = clean_line_endings(expected) task.found___ = clean_line_endings(res.output)