Skip to content

Commit

Permalink
Only check distinct errors (#7140)
Browse files Browse the repository at this point in the history
  • Loading branch information
forki authored and KevinRansom committed Jul 11, 2019
1 parent ef0949c commit 0c9ccae
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/fsharp/Compiler/CompilerAssert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,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")
Expand Down Expand Up @@ -203,4 +207,4 @@ module CompilerAssert =
||> Seq.iter2 (fun expectedErrorMessage errorMessage ->
Assert.AreEqual(expectedErrorMessage, errorMessage)
)


0 comments on commit 0c9ccae

Please sign in to comment.