mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-24 18:23:09 +03:00
Add unexpectedGlobalErrorDetails
This commit is contained in:
parent
f1f97de257
commit
253b04187e
@ -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, tooManyGlobalErrors
|
||||
, didNotExpectGlobalErrors, expectedMoreGlobalErrors, fixedCodeWhitespaceMismatch, tooManyGlobalErrors, unexpectedGlobalErrorDetails
|
||||
)
|
||||
|
||||
{-| Failure messages for the `Review.Test` module.
|
||||
@ -157,6 +157,22 @@ when I was expecting them to be:
|
||||
""" ++ formatDetails expectedDetails)
|
||||
|
||||
|
||||
unexpectedGlobalErrorDetails : List String -> { message : String, details : List String } -> String
|
||||
unexpectedGlobalErrorDetails expectedDetails error =
|
||||
failureMessage "UNEXPECTED GLOBAL ERROR DETAILS"
|
||||
("""I found a global error with the following message:
|
||||
|
||||
""" ++ wrapInQuotes error.message ++ """
|
||||
|
||||
which I was expecting, but its details were:
|
||||
|
||||
""" ++ formatDetails error.details ++ """
|
||||
|
||||
when I was expecting them to be:
|
||||
|
||||
""" ++ formatDetails expectedDetails)
|
||||
|
||||
|
||||
emptyDetails : ReviewError -> String
|
||||
emptyDetails error =
|
||||
failureMessage "EMPTY ERROR DETAILS"
|
||||
|
@ -17,6 +17,7 @@ all =
|
||||
, messageMismatchTest
|
||||
, underMismatchTest
|
||||
, unexpectedDetailsTest
|
||||
, unexpectedGlobalErrorDetailsTest
|
||||
, emptyDetailsTest
|
||||
, wrongLocationTest
|
||||
, underMayNotBeEmptyTest
|
||||
@ -342,6 +343,38 @@ when I was expecting them to be:
|
||||
]
|
||||
|
||||
|
||||
unexpectedGlobalErrorDetailsTest : Test
|
||||
unexpectedGlobalErrorDetailsTest =
|
||||
test "unexpectedGlobalErrorDetails" <|
|
||||
\() ->
|
||||
let
|
||||
expectedDetails : List String
|
||||
expectedDetails =
|
||||
[ "Some details" ]
|
||||
|
||||
error : { message : String, details : List String }
|
||||
error =
|
||||
{ message = "Some error"
|
||||
, details = [ "Some other details" ]
|
||||
}
|
||||
in
|
||||
FailureMessage.unexpectedGlobalErrorDetails expectedDetails error
|
||||
|> expectMessageEqual """
|
||||
\u{001B}[31m\u{001B}[1mUNEXPECTED GLOBAL ERROR DETAILS\u{001B}[22m\u{001B}[39m
|
||||
|
||||
I found a global error with the following message:
|
||||
|
||||
`Some error`
|
||||
|
||||
which I was expecting, but its details were:
|
||||
|
||||
`Some other details`
|
||||
|
||||
when I was expecting them to be:
|
||||
|
||||
`Some details`"""
|
||||
|
||||
|
||||
emptyDetailsTest : Test
|
||||
emptyDetailsTest =
|
||||
describe "emptyDetails"
|
||||
|
Loading…
Reference in New Issue
Block a user