From 65109211aec4a7b3c2aca168e82a15a7949d49a0 Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Mon, 2 Dec 2024 15:55:46 +0100 Subject: [PATCH 1/2] Fix error output in tests --- tests/FSharp.Test.Utilities/Compiler.fs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index 115964702f..fdd389421c 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -1515,15 +1515,17 @@ Actual: match result with | CompilationResult.Success _ -> result | CompilationResult.Failure r -> - eprintfn "\nAll errors:" - r.Diagnostics |> Seq.iter (eprintfn "%A") - + let messages = r.Diagnostics |> List.map (fun e -> $"%A{e}") |> String.concat ";\n" + let diagnostics = $"""All errors:\n{messages}""" + + eprintfn $"\n{diagnostics}" + match r.Output with | Some (EvalOutput { Result = Result.Error ex }) | Some (ExecutionOutput {Outcome = Failure ex }) -> - raise ex - | _ -> - failwithf "Operation failed (expected to succeed)." + failwithf $"Eval or Execution has failed (expected to succeed): %A{ex}\n{diagnostics}" + | _ -> + failwithf $"Operation failed (expected to succeed).\n{diagnostics}" let shouldFail (result: CompilationResult) : CompilationResult = match result with From fcb38a11029e1cd9ac9aa0bef69724a58c730e9d Mon Sep 17 00:00:00 2001 From: Vlad Zarytovskii Date: Mon, 2 Dec 2024 15:58:42 +0100 Subject: [PATCH 2/2] Fix error output in tests --- tests/FSharp.Test.Utilities/Compiler.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FSharp.Test.Utilities/Compiler.fs b/tests/FSharp.Test.Utilities/Compiler.fs index fdd389421c..cd409116c3 100644 --- a/tests/FSharp.Test.Utilities/Compiler.fs +++ b/tests/FSharp.Test.Utilities/Compiler.fs @@ -1516,7 +1516,7 @@ Actual: | CompilationResult.Success _ -> result | CompilationResult.Failure r -> let messages = r.Diagnostics |> List.map (fun e -> $"%A{e}") |> String.concat ";\n" - let diagnostics = $"""All errors:\n{messages}""" + let diagnostics = $"All errors:\n{messages}" eprintfn $"\n{diagnostics}"