mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-25 10:04:38 +03:00
Improve error when expecting errors for extra file but it's missing
This commit is contained in:
parent
469a064223
commit
50c7173fd8
@ -548,25 +548,20 @@ readmeRunResult errors project =
|
||||
extraFileRunResult : List ReviewError -> Project -> List SuccessfulRunResult
|
||||
extraFileRunResult errors project =
|
||||
let
|
||||
extraFilePaths : Dict String String
|
||||
extraFilePaths =
|
||||
Project.extraFiles project
|
||||
errorsPerFile_ : Dict String (List ReviewError)
|
||||
errorsPerFile_ =
|
||||
errorsPerFile errors
|
||||
in
|
||||
Dict.foldl
|
||||
(\path errorsForFile acc ->
|
||||
case Dict.get path extraFilePaths of
|
||||
Just content ->
|
||||
{ moduleName = path
|
||||
, inspector = codeInspectorForSource False content
|
||||
, errors = errorsForFile
|
||||
}
|
||||
:: acc
|
||||
|
||||
Nothing ->
|
||||
acc
|
||||
(\path content acc ->
|
||||
{ moduleName = path
|
||||
, inspector = codeInspectorForSource False content
|
||||
, errors = Dict.get path errorsPerFile_ |> Maybe.withDefault []
|
||||
}
|
||||
:: acc
|
||||
)
|
||||
[]
|
||||
(errorsPerFile errors)
|
||||
(Project.extraFiles project)
|
||||
|
||||
|
||||
errorsPerFile : List ReviewError -> Dict String (List ReviewError)
|
||||
|
@ -80,9 +80,10 @@ import C
|
||||
a = 1
|
||||
"""
|
||||
|> Review.Test.runWithProjectData project rule
|
||||
|> Review.Test.expectErrors
|
||||
[ Review.Test.error
|
||||
{ message = """
|
||||
|> Review.Test.expectErrorsForModules
|
||||
[ ( "A"
|
||||
, [ Review.Test.error
|
||||
{ message = """
|
||||
0 - initial context
|
||||
1.1 - withElmJsonModuleVisitor
|
||||
1.2 - withElmJsonModuleVisitor
|
||||
@ -114,9 +115,11 @@ a = 1
|
||||
12.2 - withExpressionExitVisitor
|
||||
13.1 - withDeclarationExitVisitor
|
||||
13.2 - withDeclarationExitVisitor"""
|
||||
, details = [ "details" ]
|
||||
, under = "module"
|
||||
}
|
||||
, details = [ "details" ]
|
||||
, under = "module"
|
||||
}
|
||||
]
|
||||
)
|
||||
]
|
||||
, test "should call the same type of visitors in order of call on enter, and reverse order on exit (expression)" <|
|
||||
\() ->
|
||||
|
Loading…
Reference in New Issue
Block a user