From 5ef6642e0a93cb5218d7b19f1dc75ef841cb3639 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Fri, 5 Jul 2019 07:34:09 +0200 Subject: [PATCH] Only check distinct errors --- tests/fsharp/Compiler/CompilerAssert.fs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/fsharp/Compiler/CompilerAssert.fs b/tests/fsharp/Compiler/CompilerAssert.fs index 029d9cf72d8..7741ab5de87 100644 --- a/tests/fsharp/Compiler/CompilerAssert.fs +++ b/tests/fsharp/Compiler/CompilerAssert.fs @@ -73,8 +73,12 @@ module CompilerAssert = | FSharpCheckFileAnswer.Aborted _ -> Assert.Fail("Type Checker Aborted") | FSharpCheckFileAnswer.Succeeded(typeCheckResults) -> - Assert.AreEqual(1, typeCheckResults.Errors.Length, sprintf "Expected one type check error: %A" typeCheckResults.Errors) - typeCheckResults.Errors + let errors = + typeCheckResults.Errors + |> Array.distinctBy (fun e -> e.Severity, e.ErrorNumber, e.StartLineAlternate, e.StartColumn, e.EndLineAlternate, e.EndColumn, e.Message) + + Assert.AreEqual(1, errors.Length, sprintf "Expected one type check error: %A" typeCheckResults.Errors) + errors |> Array.iter (fun info -> Assert.AreEqual(FSharpErrorSeverity.Error, info.Severity) Assert.AreEqual(expectedErrorNumber, info.ErrorNumber, "expectedErrorNumber") @@ -117,4 +121,4 @@ module CompilerAssert = ||> Seq.iter2 (fun expectedErrorMessage errorMessage -> Assert.AreEqual(expectedErrorMessage, errorMessage) ) - \ No newline at end of file +