diff options
author | w0rp <devw0rp@gmail.com> | 2019-06-04 21:51:44 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-06-04 21:51:53 +0100 |
commit | 381fff0e4c0c7c5057ed0d114169fac3a419ff85 (patch) | |
tree | aea41b60665d0250c370b99dde0f87158c655e83 /test/fix/test_ale_fix.vader | |
parent | 42a1fc2d29d710687504043dbb746eefb8248781 (diff) | |
download | ale-381fff0e4c0c7c5057ed0d114169fac3a419ff85.zip |
Make ale_lint_on_save work with b:ale_fix_on_save = 1
Diffstat (limited to 'test/fix/test_ale_fix.vader')
-rw-r--r-- | test/fix/test_ale_fix.vader | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader index 05cc4457..9dd04213 100644 --- a/test/fix/test_ale_fix.vader +++ b/test/fix/test_ale_fix.vader @@ -525,6 +525,54 @@ Expect(The buffer should be modified): $b $c +Given testft (A file with three lines): + a + b + c + +Execute(ALEFix should run the linters with b:ale_lint_on_save = 1): + let g:ale_fix_on_save = 0 + let b:ale_fix_on_save = 1 + let g:ale_lint_on_save = 1 + let g:ale_enabled = 1 + + let g:test_filename = tempname() + execute 'noautocmd silent file ' . fnameescape(g:test_filename) + call writefile(getline(1, '$'), g:test_filename) + + let g:ale_fixers.testft = ['AddDollars'] + + " We have to set the buftype to empty so the file will be written. + setlocal buftype= + + call SetUpLinters() + call ale#events#SaveEvent(bufnr('')) + call ale#test#FlushJobs() + + " We should save the file. + AssertEqual ['$a', '$b', '$c'], readfile(g:test_filename) + Assert !&modified, 'The file was marked as ''modified''' + + if !has('win32') + " We should have run the linter. + AssertEqual [{ + \ 'bufnr': bufnr('%'), + \ 'lnum': 1, + \ 'vcol': 0, + \ 'col': 1, + \ 'text': 'xxx', + \ 'type': 'E', + \ 'nr': -1, + \ 'pattern': '', + \ 'valid': 1, + \}], ale#test#GetLoclistWithoutModule() + endif + +Expect(The buffer should be modified): + $a + $b + $c + Execute(ALEFix should not fix files on :wq): let g:ale_fix_on_save = 1 let g:ale_lint_on_save = 1 |