Add tests for applying multiple fixes on a file

This commit is contained in:
Jeroen Engels 2019-08-04 12:10:54 +02:00
parent 9283ee5d8b
commit 76f0a8aaf2

View File

@ -173,4 +173,37 @@ a = 1
|> Expect.equal """module A exposing (a)
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
"""
]
()
]