]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/test_line_join.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / test_line_join.vader
1 Before:
2   let g:lines = []
3   let g:data = ''
4
5   function! LineCallback(job_id, line) abort
6     call add(g:lines, a:line)
7   endfunction
8
9   function! RawCallback(job_id, some_data) abort
10     let g:data .= a:some_data
11   endfunction
12
13 After:
14   unlet! g:last_line
15   unlet! g:lines
16   unlet! g:data
17   delfunction LineCallback
18   delfunction RawCallback
19
20 Execute (ALE should handle empty Lists for the lines):
21   let g:last_line = ale#util#JoinNeovimOutput(1, '', [], 'nl', function('LineCallback'))
22
23   AssertEqual [], g:lines
24   AssertEqual '', g:last_line
25
26 Execute (ALE should pass on full lines for NeoVim):
27   let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', 'y', ''], 'nl', function('LineCallback'))
28
29   AssertEqual ['x', 'y'], g:lines
30   AssertEqual '', g:last_line
31
32 Execute (ALE should pass on a single long line):
33   let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x'], 'nl', function('LineCallback'))
34
35   AssertEqual [], g:lines
36   AssertEqual 'x', g:last_line
37
38 Execute (ALE should handle just a single line of output):
39   let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', ''], 'nl', function('LineCallback'))
40
41   AssertEqual ['x'], g:lines
42   AssertEqual '', g:last_line
43
44 Execute (ALE should join two incomplete pieces of large lines together):
45   let g:last_line = ale#util#JoinNeovimOutput(1, 'x', ['y'], 'nl', function('LineCallback'))
46
47   AssertEqual [], g:lines
48   AssertEqual 'xy', g:last_line
49
50 Execute (ALE join incomplete lines, and set new ones):
51   let g:last_line = ale#util#JoinNeovimOutput(1, 'x', ['y', 'z', 'a'], 'nl', function('LineCallback'))
52
53   AssertEqual ['xy', 'z'], g:lines
54   AssertEqual 'a', g:last_line
55
56 Execute (ALE join incomplete lines, and set new ones, with two elements):
57   let g:last_line = ale#util#JoinNeovimOutput(1, 'x', ['y', 'z'], 'nl', function('LineCallback'))
58
59   AssertEqual ['xy'], g:lines
60   AssertEqual 'z', g:last_line
61
62 Execute (ALE should pass on full lines for NeoVim for raw data):
63   let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', 'y', ''], 'raw', function('RawCallback'))
64
65   AssertEqual "x\ny\n", g:data
66   AssertEqual '', g:last_line
67
68 Execute (ALE should pass on a single long line):
69   let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x'], 'raw', function('RawCallback'))
70
71   AssertEqual 'x', g:data
72   AssertEqual '', g:last_line
73
74 Execute (ALE should handle just a single line of output):
75   let g:last_line = ale#util#JoinNeovimOutput(1, '', ['x', ''], 'raw', function('RawCallback'))
76
77   AssertEqual "x\n", g:data
78   AssertEqual '', g:last_line
79
80 Execute (ALE should pass on two lines and one incomplete one):
81   let g:last_line = ale#util#JoinNeovimOutput(1, '', ['y', 'z', 'a'], 'raw', function('RawCallback'))
82
83   AssertEqual "y\nz\na", g:data
84   AssertEqual '', g:last_line