summaryrefslogtreecommitdiff
path: root/test/test_wrap_comand.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-12-20 12:20:38 +0000
committerw0rp <devw0rp@gmail.com>2017-12-20 12:20:38 +0000
commite43e7065da17f45e4cce127a319ceee0a0311883 (patch)
tree2ab29efb8171921872a0b36fab116ea9ce1f1cfb /test/test_wrap_comand.vader
parent2495744fc31e0041cc4ed6b7b6fdc1b1a15ffb62 (diff)
downloadale-e43e7065da17f45e4cce127a319ceee0a0311883.zip
Fix #1115 - Add support for wrapping all commands with an option
Diffstat (limited to 'test/test_wrap_comand.vader')
-rw-r--r--test/test_wrap_comand.vader48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/test_wrap_comand.vader b/test/test_wrap_comand.vader
new file mode 100644
index 00000000..8c1569b1
--- /dev/null
+++ b/test/test_wrap_comand.vader
@@ -0,0 +1,48 @@
+Before:
+ Save g:ale_command_wrapper
+
+ let g:ale_command_wrapper = ''
+
+ function! TestCommand(expected_part, input) abort
+ let l:expected = has('win32')
+ \ ? 'cmd /c ' . a:expected_part
+ \ : split(&shell) + split(&shellcmdflag) + [a:expected_part]
+
+ AssertEqual l:expected, ale#job#PrepareCommand(bufnr(''), a:input)
+ endfunction
+
+After:
+ Restore
+
+ unlet! b:ale_command_wrapper
+
+ delfunction TestCommand
+
+Execute(The command wrapper should work with a nice command):
+ let b:ale_command_wrapper = 'nice -n 5'
+
+ call TestCommand('nice -n 5 foo bar', 'foo bar')
+
+Execute(The command wrapper should work with a nice command with an explicit marker):
+ let b:ale_command_wrapper = 'nice -n 5 %*'
+
+ call TestCommand('nice -n 5 foo bar', 'foo bar')
+
+Execute(Wrappers with spread arguments in the middle should be suppported):
+ let b:ale_command_wrapper = 'wrap %* --'
+
+ call TestCommand('wrap foo bar --', 'foo bar')
+
+Execute(Wrappers with the command as one argument should be supported):
+ let b:ale_command_wrapper = 'wrap -c %@ -x'
+
+ call TestCommand('wrap -c ' . ale#Escape('foo bar') . ' -x', 'foo bar')
+
+Execute(&& and ; should be moved to the front):
+ let b:ale_command_wrapper = 'wrap -c %@ -x'
+
+ call TestCommand('foo && bar; wrap -c ' . ale#Escape('baz') . ' -x', 'foo && bar;baz')
+
+ let b:ale_command_wrapper = 'nice -n 5'
+
+ call TestCommand('foo && bar; nice -n 5 baz -z', 'foo && bar;baz -z')