summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-22 13:01:13 +0000
committerw0rp <devw0rp@gmail.com>2017-11-22 13:01:13 +0000
commit3f70f1cbf1baee707fe78968f57950b78fc6c19b (patch)
tree629c776330271c9d34efd22f17fd89c3c1fc72de /test
parente7865d2f9482497b568c11cf1f07a740d2da3907 (diff)
downloadale-3f70f1cbf1baee707fe78968f57950b78fc6c19b.zip
Disable piping buffer data into commands for fixing files where needed
Diffstat (limited to 'test')
-rw-r--r--test/test_ale_fix.vader24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/test_ale_fix.vader b/test/test_ale_fix.vader
index aeb5bd09..07a53c75 100644
--- a/test/test_ale_fix.vader
+++ b/test/test_ale_fix.vader
@@ -110,6 +110,10 @@ Before:
return {'command': has('win32') ? 'echo(' : 'echo'}
endfunction
+ function! EchoLineNoPipe(buffer, output)
+ return {'command': 'echo new line', 'read_buffer': 0}
+ endfunction
+
function! SetUpLinters()
call ale#linter#Define('testft', {
\ 'name': 'testlinter',
@@ -155,6 +159,7 @@ After:
delfunction SetUpLinters
delfunction GetLastMessage
delfunction IgnoredEmptyOutput
+ delfunction EchoLineNoPipe
call ale#test#RestoreDirectory()
@@ -540,6 +545,14 @@ Execute(Test fixing with chained callbacks):
let g:ale_fixers.testft = ['FirstChainCallback']
ALEFix
+ " The buffer shouldn't be piped in for earlier commands in the chain.
+ AssertEqual
+ \ [
+ \ string(ale#job#PrepareCommand('echo echoline')),
+ \ string(ale#job#PrepareCommand('echo echoline')),
+ \ ],
+ \ map(ale#history#Get(bufnr(''))[-2:-1], 'string(v:val.command)')
+
Expect(The echoed line should be added):
a
b
@@ -583,3 +596,14 @@ Expect(The lines should be the same):
a
b
c
+
+Execute(A temporary file shouldn't be piped into the command when disabled):
+ let g:ale_fixers.testft = ['EchoLineNoPipe']
+ ALEFix
+
+ AssertEqual
+ \ string(ale#job#PrepareCommand('echo new line')),
+ \ string(ale#history#Get(bufnr(''))[-1].command)
+
+Expect(The new line should be used):
+ new line