diff options
Diffstat (limited to 'test/fix/test_ale_fix.vader')
-rw-r--r-- | test/fix/test_ale_fix.vader | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader index 817c243d..417394c3 100644 --- a/test/fix/test_ale_fix.vader +++ b/test/fix/test_ale_fix.vader @@ -17,6 +17,14 @@ Before: \ 'testft': [], \} + let g:pre_success = 0 + let g:post_success = 0 + augroup VaderTest + autocmd! + autocmd User ALEFixPre let g:pre_success = 1 + autocmd User ALEFixPost let g:post_success = 1 + augroup end + if !has('win32') let &shell = '/bin/bash' endif @@ -171,6 +179,7 @@ After: unlet! g:ale_emulate_job_failure unlet! b:ale_fixers unlet! b:ale_fix_on_save + augroup! VaderTest delfunction AddCarets delfunction AddDollars delfunction DoNothing @@ -248,6 +257,25 @@ Expect(Only the second function should be applied): $b $c +Execute(The * fixers shouldn't be used if an empty list is set for fixers): + let g:ale_fixers.testft = [] + let g:ale_fixers['*'] = ['AddDollars'] + ALEFix + +Expect(Nothing should be changed): + a + b + c + +Execute(* fixers should be used if no filetype is matched): + let g:ale_fixers = {'*': ['AddDollars']} + ALEFix + +Expect(The file should be changed): + $a + $b + $c + Execute(ALEFix should allow commands to be run): if has('win32') " Just skip this test on Windows, we can't run it. @@ -263,6 +291,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. @@ -574,6 +611,16 @@ Execute(ALE should print a message telling you something isn't a valid fixer whe AssertEqual 'There is no fixer named `invalidname`. Check :ALEFixSuggest', GetLastMessage() +Execute(ALE should complain about invalid fixers with minuses in the name): + let g:ale_fixers.testft = ['foo-bar'] + ALEFix + + AssertEqual 'There is no fixer named `foo-bar`. Check :ALEFixSuggest', GetLastMessage() + +Execute(ALE should tolerate valid fixers with minuses in the name): + let g:ale_fixers.testft = ['prettier-standard'] + ALEFix + Execute(Test fixing with chained callbacks): let g:ale_fixers.testft = ['FirstChainCallback'] ALEFix @@ -654,3 +701,9 @@ Expect(The lines in the JSON should be used): x y z + +Execute(ALEFix should apply autocmds): + let g:ale_fixers.testft = ['AddCarets'] + ALEFix + AssertEqual g:pre_success, 1 + AssertEqual g:post_success, 1 |