Fix an off-by-one bug in ALEFix

This commit is contained in:
w0rp
2017-05-19 09:53:28 +01:00
parent 4214832ae2
commit e6b132c915
2 changed files with 13 additions and 1 deletions

View File

@@ -28,6 +28,9 @@ Before:
return {'command': 'echo x > %t', 'read_temporary_file': 1}
endfunction
function RemoveLastLine(buffer, lines) abort
return ['a', 'b']
endfunction
After:
Restore
unlet! g:ale_run_synchronously
@@ -37,6 +40,7 @@ After:
delfunction DoNothing
delfunction CatLine
delfunction ReplaceWithTempFile
delfunction RemoveLastLine
call ale#fix#registry#ResetToDefaults()
Given testft (A file with three lines):
@@ -137,3 +141,11 @@ Expect(The registry function should be used):
^a
^b
^c
Execute(ALEFix should be able to remove the last line for files):
let g:ale_fixers.testft = ['RemoveLastLine']
ALEFix
Expect(There should be only two lines):
a
b