mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-29 01:24:35 +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 : List ReviewError -> Project -> List SuccessfulRunResult
|
||||||
extraFileRunResult errors project =
|
extraFileRunResult errors project =
|
||||||
let
|
let
|
||||||
extraFilePaths : Dict String String
|
errorsPerFile_ : Dict String (List ReviewError)
|
||||||
extraFilePaths =
|
errorsPerFile_ =
|
||||||
Project.extraFiles project
|
errorsPerFile errors
|
||||||
in
|
in
|
||||||
Dict.foldl
|
Dict.foldl
|
||||||
(\path errorsForFile acc ->
|
(\path content acc ->
|
||||||
case Dict.get path extraFilePaths of
|
|
||||||
Just content ->
|
|
||||||
{ moduleName = path
|
{ moduleName = path
|
||||||
, inspector = codeInspectorForSource False content
|
, inspector = codeInspectorForSource False content
|
||||||
, errors = errorsForFile
|
, errors = Dict.get path errorsPerFile_ |> Maybe.withDefault []
|
||||||
}
|
}
|
||||||
:: acc
|
:: acc
|
||||||
|
|
||||||
Nothing ->
|
|
||||||
acc
|
|
||||||
)
|
)
|
||||||
[]
|
[]
|
||||||
(errorsPerFile errors)
|
(Project.extraFiles project)
|
||||||
|
|
||||||
|
|
||||||
errorsPerFile : List ReviewError -> Dict String (List ReviewError)
|
errorsPerFile : List ReviewError -> Dict String (List ReviewError)
|
||||||
|
@ -80,8 +80,9 @@ import C
|
|||||||
a = 1
|
a = 1
|
||||||
"""
|
"""
|
||||||
|> Review.Test.runWithProjectData project rule
|
|> Review.Test.runWithProjectData project rule
|
||||||
|> Review.Test.expectErrors
|
|> Review.Test.expectErrorsForModules
|
||||||
[ Review.Test.error
|
[ ( "A"
|
||||||
|
, [ Review.Test.error
|
||||||
{ message = """
|
{ message = """
|
||||||
0 - initial context
|
0 - initial context
|
||||||
1.1 - withElmJsonModuleVisitor
|
1.1 - withElmJsonModuleVisitor
|
||||||
@ -118,6 +119,8 @@ a = 1
|
|||||||
, under = "module"
|
, under = "module"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
)
|
||||||
|
]
|
||||||
, test "should call the same type of visitors in order of call on enter, and reverse order on exit (expression)" <|
|
, test "should call the same type of visitors in order of call on enter, and reverse order on exit (expression)" <|
|
||||||
\() ->
|
\() ->
|
||||||
let
|
let
|
||||||
|
Loading…
Reference in New Issue
Block a user