Add tests for ALEFix commandline parameters

This commit is contained in:
fenuks 2018-04-18 01:10:51 +02:00
parent a591b191db
commit f16384f323
2 changed files with 32 additions and 0 deletions

View File

@ -272,6 +272,15 @@ Expect(An extra line should be added):
c
d
Execute(ALEFix should use fixers passed in commandline when provided):
let g:ale_fixers.testft = ['RemoveLastLine']
ALEFix AddCarets AddDollars
Expect(Only fixers passed via command line should be run):
$^a
$^b
$^c
Execute(ALEFix should allow temporary files to be read):
if has('win32')
" Just skip this test on Windows, we can't run it.

View File

@ -0,0 +1,23 @@
Execute (List of available fixers is empty):
call ale#fix#registry#Clear()
Then (List of applicable fixers for python file is empty):
AssertEqual [], ale#fix#registry#GetApplicableFixers('python')
Execute (Add ruby fixer):
call ale#fix#registry#Add('ruby_fixer', 'fixer_fun', ['ruby'], 'ruby fixer')
Then (List of applicable fixers for python file is still empty):
AssertEqual [], ale#fix#registry#GetApplicableFixers('python')
Execute (Add generic fixer):
call ale#fix#registry#Add('generic_fixer', 'fixer_fun', [], 'generic fixer')
Then (Generic fixer should be returned as applicable for python file):
AssertEqual ['generic_fixer'], ale#fix#registry#GetApplicableFixers('python')
Execute (Add python fixer):
call ale#fix#registry#Add('python_fixer', 'fixer_func', ['python'], 'python fixer')
Then (List of fixers should contain both generic and python fixers):
AssertEqual ['generic_fixer', 'python_fixer'], ale#fix#registry#GetApplicableFixers('python')