]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/test_wrap_comand.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 '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / test / test_wrap_comand.vader
1 Before:
2   Save g:ale_command_wrapper
3
4   let g:ale_command_wrapper = ''
5
6   function! TestCommand(expected_part, input) abort
7     let l:expected = has('win32')
8     \ ? 'cmd /s/c "' . a:expected_part . '"'
9     \ : split(&shell) + split(&shellcmdflag) + [a:expected_part]
10
11     AssertEqual l:expected, ale#job#PrepareCommand(bufnr(''), a:input)
12   endfunction
13
14 After:
15   Restore
16
17   unlet! b:ale_command_wrapper
18
19   delfunction TestCommand
20
21 Execute(The command wrapper should work with a nice command):
22   let b:ale_command_wrapper = 'nice -n 5'
23
24   call TestCommand('nice -n 5 foo bar', 'foo bar')
25
26 Execute(The command wrapper should spread arguments correctly):
27   let b:ale_command_wrapper = 'wrap %* --'
28
29   call TestCommand('wrap foo bar --', 'foo bar')
30
31 Execute(Wrappers with the command as one argument should be supported):
32   let b:ale_command_wrapper = 'wrap -c %@ -x'
33
34   call TestCommand('wrap -c ' . ale#Escape('foo bar') . ' -x', 'foo bar')
35
36 Execute(&& and ; should be moved to the front):
37   let b:ale_command_wrapper = 'wrap -c %@ -x'
38
39   call TestCommand('foo && bar; wrap -c ' . ale#Escape('baz') . ' -x', 'foo && bar;baz')
40
41   let b:ale_command_wrapper = 'nice -n 5'
42
43   call TestCommand('foo && bar; nice -n 5 baz -z', 'foo && bar;baz -z')