summaryrefslogtreecommitdiff
path: root/test/fix/test_ale_fix.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-11-10 10:06:48 +0000
committerw0rp <devw0rp@gmail.com>2018-11-10 10:06:56 +0000
commitf8d3ffb60e132e3c4b0b853b9ae21b49acdacd5d (patch)
tree64d9bc3f4d8b727ff7b0b09bc1b8bed978258fa7 /test/fix/test_ale_fix.vader
parente4faf82cab34869c5ecdc097b9eb0209c9ad9318 (diff)
downloadale-f8d3ffb60e132e3c4b0b853b9ae21b49acdacd5d.zip
Fix #1960 - Do not fix files on :wq
Diffstat (limited to 'test/fix/test_ale_fix.vader')
-rw-r--r--test/fix/test_ale_fix.vader33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader
index 539972a4..90407681 100644
--- a/test/fix/test_ale_fix.vader
+++ b/test/fix/test_ale_fix.vader
@@ -180,6 +180,7 @@ After:
unlet! g:ale_emulate_job_failure
unlet! b:ale_fixers
unlet! b:ale_fix_on_save
+ unlet! b:ale_quitting
delfunction AddCarets
delfunction AddDollars
delfunction DoNothing
@@ -431,7 +432,7 @@ Given testft (A file with three lines):
b
c
-Execute(ALEFix should save files on the save event):
+Execute(ALEFix should fix files on the save event):
let g:ale_fix_on_save = 1
let g:ale_lint_on_save = 1
let g:ale_enabled = 1
@@ -471,6 +472,36 @@ Expect(The buffer should be modified):
$b
$c
+Execute(ALEFix should not fix files on :wq):
+ let g:ale_fix_on_save = 1
+ let g:ale_lint_on_save = 1
+ let g:ale_enabled = 1
+
+ noautocmd silent file fix_test_file
+ call writefile(getline(1, '$'), 'fix_test_file')
+
+ let g:ale_fixers.testft = ['AddDollars']
+
+ " We have to set the buftype to empty so the file will be written.
+ setlocal buftype=
+
+ call ale#events#QuitEvent(bufnr(''))
+
+ call SetUpLinters()
+ call ale#events#SaveEvent(bufnr(''))
+
+ " We should save the file.
+ AssertEqual ['a', 'b', 'c'], readfile('fix_test_file')
+ Assert &modified, 'The was not marked as ''modified'''
+
+ " We should not run the linter.
+ AssertEqual [], ale#test#GetLoclistWithoutModule()
+
+Expect(The buffer should not be modified):
+ a
+ b
+ c
+
Given testft (A file with three lines):
a
b