Report error that says message is different

This commit is contained in:
Jeroen Engels 2021-03-09 23:23:57 +01:00
parent 851be878a3
commit 538597177e
2 changed files with 14 additions and 2 deletions

View File

@ -1479,4 +1479,4 @@ expectConfigurationError expectedError reviewResult =
expectConfigurationErrorDetailsMatch : { message : String, details : List String } -> { message : String, details : List String } -> Expectation
expectConfigurationErrorDetailsMatch expectedError configurationError =
Expect.fail (FailureMessage.unexpectedConfigurationError configurationError)
Expect.fail (FailureMessage.messageMismatchForConfigurationError expectedError configurationError)

View File

@ -4,7 +4,7 @@ module Review.Test.FailureMessage exposing
, underMismatch, expectedMoreErrors, tooManyErrors, locationNotFound, underMayNotBeEmpty, locationIsAmbiguousInSourceCode
, needToUsedExpectErrorsForModules, missingSources, duplicateModuleName, unknownModulesInExpectedErrors
, missingFixes, unexpectedFixes, fixedCodeMismatch, unchangedSourceAfterFix, invalidSourceAfterFix, hasCollisionsInFixRanges
, didNotExpectGlobalErrors, expectedMoreGlobalErrors, fixedCodeWhitespaceMismatch, messageMismatchForGlobalError, missingConfigurationError, tooManyGlobalErrors, unexpectedConfigurationError, unexpectedGlobalErrorDetails
, didNotExpectGlobalErrors, expectedMoreGlobalErrors, fixedCodeWhitespaceMismatch, messageMismatchForConfigurationError, messageMismatchForGlobalError, missingConfigurationError, tooManyGlobalErrors, unexpectedConfigurationError, unexpectedGlobalErrorDetails
)
{-| Failure messages for the `Review.Test` module.
@ -134,6 +134,18 @@ but I found the following error message:
""" ++ wrapInQuotes error.message)
messageMismatchForConfigurationError : { a | message : String } -> { b | message : String } -> String
messageMismatchForConfigurationError expectedError error =
failureMessage "UNEXPECTED CONFIGURATION ERROR MESSAGE"
("""I was looking for the configuration error with the following message:
""" ++ wrapInQuotes expectedError.message ++ """
but I found the following error message:
""" ++ wrapInQuotes error.message)
underMismatch : ReviewError -> { under : String, codeAtLocation : String } -> String
underMismatch error { under, codeAtLocation } =
failureMessage "UNEXPECTED ERROR LOCATION"