#254 Capture command exit codes in the history

This commit is contained in:
w0rp
2017-02-16 22:19:53 +00:00
parent ca17b5aebd
commit 843370b96f
5 changed files with 82 additions and 4 deletions

View File

@@ -191,3 +191,30 @@ Execute (ALEInfo should return command history):
\ '(started) [''/bin/bash'', ''\c'', ''last command'']',
\ ], "\n"),
\ g:output
Given testft.testft2 (Empty buffer with two filetypes):
Execute (ALEInfo command history should print exit codes correctly):
let g:ale_buffer_info[bufnr('%')] = {
\ 'history': [
\ {'status': 'finished', 'exit_code': 0, 'job_id': 347, 'command': 'first command'},
\ {'status': 'finished', 'exit_code': 1, 'job_id': 347, 'command': ['/bin/bash', '\c', 'last command']},
\ ],
\}
call ale#linter#Define('testft', g:testlinter1)
call ale#linter#Define('testft2', g:testlinter2)
redir => g:output
silent ALEInfo
redir END
AssertEqual
\ join([
\ '',
\ ' Current Filetype: testft.testft2',
\ 'Available Linters: [''testlinter1'', ''testlinter2'']',
\ ' Enabled Linters: [''testlinter1'', ''testlinter2'']',
\ ' Linter Variables:',
\ g:globals_string . g:command_header,
\ '(finished - exit code 0) ''first command''',
\ '(finished - exit code 1) [''/bin/bash'', ''\c'', ''last command'']',
\ ], "\n"),
\ g:output

View File

@@ -35,9 +35,10 @@ Execute(History should be set when commands are run):
let g:history = g:ale_buffer_info[bufnr('%')].history
AssertEqual 1, len(g:history)
AssertEqual ['status', 'job_id', 'command'], keys(g:history[0])
AssertEqual sort(['status', 'exit_code', 'job_id', 'command']), sort(keys(g:history[0]))
AssertEqual ['/bin/bash', '-c', 'echo command history test'], g:history[0].command
AssertEqual 'started', g:history[0].status
AssertEqual 'finished', g:history[0].status
AssertEqual 0, g:history[0].exit_code
" The Job ID will change each time, but we can check the type.
AssertEqual type(1), type(g:history[0].job_id)