summaryrefslogtreecommitdiff
path: root/test/fix/test_ale_fix.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2019-05-13 13:44:29 +0100
committerw0rp <devw0rp@gmail.com>2019-05-13 13:44:29 +0100
commit42cbff29f8613729cfd9c26db9ed55a0bf484f2c (patch)
tree638603b144284ce270b0b03c13ea261189fe0e26 /test/fix/test_ale_fix.vader
parentbf17bbf898da6763e305a3e92f041532221719b0 (diff)
downloadale-42cbff29f8613729cfd9c26db9ed55a0bf484f2c.zip
Fix #2497 - ALE should not lint on save when disabled after fixing
Diffstat (limited to 'test/fix/test_ale_fix.vader')
-rw-r--r--test/fix/test_ale_fix.vader48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader
index 9e5ad027..05cc4457 100644
--- a/test/fix/test_ale_fix.vader
+++ b/test/fix/test_ale_fix.vader
@@ -8,6 +8,7 @@ Before:
silent! cd /testplugin/test/fix
+ unlet! b:ale_lint_on_save
let g:ale_enabled = 0
let g:ale_echo_cursor = 0
let g:ale_run_synchronously = 1
@@ -191,6 +192,7 @@ After:
unlet! g:ale_run_synchronously_callbacks
unlet! g:ale_emulate_job_failure
unlet! b:ale_fixers
+ unlet! b:ale_lint_on_save
unlet! b:ale_fix_on_save
unlet! b:ale_quitting
delfunction AddCarets
@@ -631,6 +633,52 @@ Expect(The buffer should be the same):
b
c
+Execute(ALEFix should not lint the buffer on save if linting on save is disabled globally):
+ let g:ale_fix_on_save = 1
+ let g:ale_lint_on_save = 0
+ let g:ale_enabled = 1
+
+ let g:test_filename = tempname()
+ execute 'noautocmd silent file ' . fnameescape(g:test_filename)
+
+ let g:ale_fixers.testft = ['DoNothing']
+
+ call SetUpLinters()
+ call ale#events#SaveEvent(bufnr(''))
+ call ale#test#FlushJobs()
+
+ Assert !filereadable(g:test_filename), 'The file should not have been saved'
+
+ AssertEqual [], ale#test#GetLoclistWithoutModule()
+
+Expect(The buffer should be the same):
+ a
+ b
+ c
+
+Execute(ALEFix should not lint the buffer on save if linting on save is disabled locally):
+ let g:ale_fix_on_save = 1
+ let b:ale_lint_on_save = 0
+ let g:ale_enabled = 1
+
+ let g:test_filename = tempname()
+ execute 'noautocmd silent file ' . fnameescape(g:test_filename)
+
+ let g:ale_fixers.testft = ['DoNothing']
+
+ call SetUpLinters()
+ call ale#events#SaveEvent(bufnr(''))
+ call ale#test#FlushJobs()
+
+ Assert !filereadable(g:test_filename), 'The file should not have been saved'
+
+ AssertEqual [], ale#test#GetLoclistWithoutModule()
+
+Expect(The buffer should be the same):
+ a
+ b
+ c
+
Given testft (A file with three lines):
a
b