summaryrefslogtreecommitdiff
path: root/test/fix/test_ale_fix.vader
diff options
context:
space:
mode:
authorBartek thindil Jasicki <thindil@laeran.pl>2020-08-21 10:39:39 +0200
committerBartek thindil Jasicki <thindil@laeran.pl>2020-08-21 10:39:39 +0200
commit62f07d820c2b474216657bd43a3a919469c9584f (patch)
treeaf1263e71c33895e270f08d541688072c358829d /test/fix/test_ale_fix.vader
parent04bd84e914af02e1c7d61ccf8f8368de85eab30e (diff)
parent2b785688ead505dcbc1007374d3dca9914aa247a (diff)
downloadale-62f07d820c2b474216657bd43a3a919469c9584f.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'test/fix/test_ale_fix.vader')
-rw-r--r--test/fix/test_ale_fix.vader110
1 files changed, 2 insertions, 108 deletions
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader
index c3dd20e4..53079d16 100644
--- a/test/fix/test_ale_fix.vader
+++ b/test/fix/test_ale_fix.vader
@@ -5,12 +5,14 @@ Before:
Save g:ale_fix_on_save
Save g:ale_lint_on_save
Save g:ale_echo_cursor
+ Save g:ale_command_wrapper
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_command_wrapper = ''
let g:ale_run_synchronously = 1
let g:ale_set_lists_synchronously = 1
let g:ale_fix_buffer_data = {}
@@ -82,56 +84,6 @@ Before:
return [{'lnum': 1, 'col': 1, 'text': 'xxx'}]
endfunction
- function! FirstChainCallback(buffer)
- return {'command': 'echo echoline', 'chain_with': 'SecondChainCallback'}
- endfunction
-
- function! FirstChainCallbackSkipped(buffer)
- let l:ChainWith = 'SecondChainCallback'
-
- " Test with lambdas where support is available.
- if has('lambda')
- let l:ChainWith = {buffer, output -> SecondChainCallback(buffer, output)}
- endif
-
- return {'command': '', 'chain_with': l:ChainWith}
- endfunction
-
- function! FirstChainCallbackSecondSkipped(buffer)
- return {'command': 'echo skipit', 'chain_with': 'SecondChainCallback'}
- endfunction
-
- function! SecondChainCallback(buffer, output)
- let l:previous_line = empty(a:output)
- \ ? 'emptydefault'
- \ : join(split(a:output[0]))
-
- if l:previous_line is# 'skipit'
- return {'command': '', 'chain_with': 'ThirdChainCallback'}
- endif
-
- return {
- \ 'command': 'echo ' . l:previous_line,
- \ 'chain_with': 'ThirdChainCallback',
- \}
- endfunction
-
- function! ThirdChainCallback(buffer, output, input)
- let l:previous_line = empty(a:output)
- \ ? 'thirddefault'
- \ : join(split(a:output[0]))
-
- return a:input + [l:previous_line]
- endfunction
-
- function! ChainWhereLastIsSkipped(buffer)
- return {'command': 'echo echoline', 'chain_with': 'ChainEndSkipped'}
- endfunction
-
- function! ChainEndSkipped(buffer, output)
- return {'command': ''}
- endfunction
-
" echo will output a single blank line, and we should ingore it.
function! IgnoredEmptyOutput(buffer, output)
return {'command': has('win32') ? 'echo(' : 'echo'}
@@ -206,13 +158,6 @@ After:
delfunction RemoveLastLine
delfunction RemoveLastLineOneArg
delfunction TestCallback
- delfunction FirstChainCallback
- delfunction FirstChainCallbackSkipped
- delfunction FirstChainCallbackSecondSkipped
- delfunction SecondChainCallback
- delfunction ThirdChainCallback
- delfunction ChainWhereLastIsSkipped
- delfunction ChainEndSkipped
delfunction SetUpLinters
delfunction GetLastMessage
delfunction IgnoredEmptyOutput
@@ -814,57 +759,6 @@ Execute(ALE should tolerate valid fixers with minuses in the name):
ALEFix
call ale#test#FlushJobs()
-Execute(Test fixing with chained callbacks):
- let g:ale_fixers.testft = ['FirstChainCallback']
- ALEFix
- call ale#test#FlushJobs()
-
- " The buffer shouldn't be piped in for earlier commands in the chain.
- AssertEqual
- \ [
- \ string(ale#job#PrepareCommand(bufnr(''), 'echo echoline')),
- \ string(ale#job#PrepareCommand(bufnr(''), 'echo echoline')),
- \ ],
- \ map(ale#history#Get(bufnr(''))[-2:-1], 'string(v:val.command)')
-
-Expect(The echoed line should be added):
- a
- b
- c
- echoline
-
-Execute(Test fixing with chained callback where the first command is skipped):
- let g:ale_fixers.testft = ['FirstChainCallbackSkipped']
- ALEFix
- call ale#test#FlushJobs()
-
-Expect(The default line should be added):
- a
- b
- c
- emptydefault
-
-Execute(Test fixing with chained callback where the second command is skipped):
- let g:ale_fixers.testft = ['FirstChainCallbackSecondSkipped']
- ALEFix
- call ale#test#FlushJobs()
-
-Expect(The default line should be added):
- a
- b
- c
- thirddefault
-
-Execute(Test fixing with chained callback where the final callback is skipped):
- let g:ale_fixers.testft = ['ChainWhereLastIsSkipped']
- ALEFix
- call ale#test#FlushJobs()
-
-Expect(The lines should be the same):
- a
- b
- c
-
Execute(Empty output should be ignored):
let g:ale_fixers.testft = ['IgnoredEmptyOutput']
ALEFix