2017-01-19 20:01:51 +00:00
|
|
|
Before:
|
2017-05-20 11:49:55 +00:00
|
|
|
let g:lines = []
|
2017-06-14 16:08:39 +00:00
|
|
|
let g:data = ''
|
2017-05-20 11:49:55 +00:00
|
|
|
|
2017-06-14 16:08:39 +00:00
|
|
|
function! LineCallback(job_id, line) abort
|
2017-05-20 11:49:55 +00:00
|
|
|
call add(g:lines, a:line)
|
|
|
|
endfunction
|
2017-01-19 20:01:51 +00:00
|
|
|
|
2017-06-14 16:08:39 +00:00
|
|
|
function! RawCallback(job_id, some_data) abort
|
|
|
|
let g:data .= a:some_data
|
|
|
|
endfunction
|
|
|
|
|
2017-01-19 20:01:51 +00:00
|
|
|
After:
|
2017-05-20 11:49:55 +00:00
|
|
|
unlet! g:last_line
|
|
|
|
unlet! g:lines
|
2017-06-14 16:08:39 +00:00
|
|
|
unlet! g:data
|
2017-05-20 11:49:55 +00:00
|
|
|
delfunction LineCallback
|
2017-06-14 16:08:39 +00:00
|
|
|
delfunction RawCallback
|
2017-05-20 11:49:55 +00:00
|
|
|
|
|
|
|
Execute (ALE should pass on full lines for NeoVim):
|
2017-06-14 16:08:39 +00:00
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x', 'y', ''], 'nl', function('LineCallback'))
|
2017-05-20 11:49:55 +00:00
|
|
|
|
|
|
|
AssertEqual ['x', 'y'], g:lines
|
|
|
|
AssertEqual '', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE should pass on a single long line):
|
2017-06-14 16:08:39 +00:00
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x'], 'nl', function('LineCallback'))
|
2017-05-20 11:49:55 +00:00
|
|
|
|
|
|
|
AssertEqual [], g:lines
|
|
|
|
AssertEqual 'x', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE should handle just a single line of output):
|
2017-06-14 16:08:39 +00:00
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x', ''], 'nl', function('LineCallback'))
|
2017-05-20 11:49:55 +00:00
|
|
|
|
|
|
|
AssertEqual ['x'], g:lines
|
|
|
|
AssertEqual '', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE should join two incomplete pieces of large lines together):
|
2017-06-14 16:08:39 +00:00
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y'], 'nl', function('LineCallback'))
|
2017-05-20 11:49:55 +00:00
|
|
|
|
|
|
|
AssertEqual [], g:lines
|
|
|
|
AssertEqual 'xy', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE join incomplete lines, and set new ones):
|
2017-06-14 16:08:39 +00:00
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y', 'z', 'a'], 'nl', function('LineCallback'))
|
2017-05-20 11:49:55 +00:00
|
|
|
|
|
|
|
AssertEqual ['xy', 'z'], g:lines
|
|
|
|
AssertEqual 'a', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE join incomplete lines, and set new ones, with two elements):
|
2017-06-14 16:08:39 +00:00
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y', 'z'], 'nl', function('LineCallback'))
|
2017-05-20 11:49:55 +00:00
|
|
|
|
|
|
|
AssertEqual ['xy'], g:lines
|
|
|
|
AssertEqual 'z', g:last_line
|
2017-06-14 16:08:39 +00:00
|
|
|
|
|
|
|
Execute (ALE should pass on full lines for NeoVim for raw data):
|
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x', 'y', ''], 'raw', function('RawCallback'))
|
|
|
|
|
|
|
|
AssertEqual "x\ny\n", g:data
|
|
|
|
AssertEqual '', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE should pass on a single long line):
|
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x'], 'raw', function('RawCallback'))
|
|
|
|
|
|
|
|
AssertEqual '', g:data
|
|
|
|
AssertEqual 'x', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE should handle just a single line of output):
|
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, '', ['x', ''], 'raw', function('RawCallback'))
|
|
|
|
|
|
|
|
AssertEqual "x\n", g:data
|
|
|
|
AssertEqual '', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE should join two incomplete pieces of large lines together):
|
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y'], 'raw', function('RawCallback'))
|
|
|
|
|
|
|
|
AssertEqual '', g:data
|
|
|
|
AssertEqual 'xy', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE join incomplete lines, and set new ones):
|
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y', 'z', 'a'], 'raw', function('RawCallback'))
|
|
|
|
|
|
|
|
AssertEqual "xy\nz\n", g:data
|
|
|
|
AssertEqual 'a', g:last_line
|
|
|
|
|
|
|
|
Execute (ALE join incomplete lines, and set new ones, with two elements):
|
|
|
|
let g:last_line = ale#job#JoinNeovimOutput(1, 'x', ['y', 'z'], 'raw', function('RawCallback'))
|
|
|
|
|
|
|
|
AssertEqual "xy\n", g:data
|
|
|
|
AssertEqual 'z', g:last_line
|