mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-18 07:01:48 +03:00
Add tests for applying multiple fixes on a file
This commit is contained in:
parent
9283ee5d8b
commit
76f0a8aaf2
@ -173,4 +173,37 @@ a = 1
|
|||||||
|> Expect.equal """module A exposing (a)
|
|> Expect.equal """module A exposing (a)
|
||||||
a = Debug.log "foo" 1
|
a = Debug.log "foo" 1
|
||||||
"""
|
"""
|
||||||
|
, test "should apply multiple fixes regardless of the order" <|
|
||||||
|
\() ->
|
||||||
|
let
|
||||||
|
source : String
|
||||||
|
source =
|
||||||
|
"""module A exposing (a)
|
||||||
|
a = 1
|
||||||
|
"""
|
||||||
|
|
||||||
|
fixes =
|
||||||
|
[ Fix.replaceRangeBy
|
||||||
|
{ start = { row = 2, column = 1 }
|
||||||
|
, end = { row = 2, column = 2 }
|
||||||
|
}
|
||||||
|
"someVar"
|
||||||
|
, Fix.insertAt
|
||||||
|
{ row = 2, column = 5 }
|
||||||
|
"""Debug.log "foo" """
|
||||||
|
]
|
||||||
|
in
|
||||||
|
Expect.all
|
||||||
|
[ \() ->
|
||||||
|
Fix.fix fixes source
|
||||||
|
|> Expect.equal """module A exposing (a)
|
||||||
|
someVar = Debug.log "foo" 1
|
||||||
|
"""
|
||||||
|
, \() ->
|
||||||
|
Fix.fix (List.reverse fixes) source
|
||||||
|
|> Expect.equal """module A exposing (a)
|
||||||
|
someVar = Debug.log "foo" 1
|
||||||
|
"""
|
||||||
|
]
|
||||||
|
()
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user