summaryrefslogtreecommitdiff
path: root/test/smoke_test.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-01-17 18:08:17 +0000
committerw0rp <devw0rp@gmail.com>2018-01-17 18:08:17 +0000
commit045c92ed655214ef7503c2d592e41eb0ba4bf041 (patch)
tree61c1bd04cd2f9062e942dc882a4c0b14217ab713 /test/smoke_test.vader
parentf6af75aac46f2d4ac72ea8256ac871f7cbf158f6 (diff)
downloadale-045c92ed655214ef7503c2d592e41eb0ba4bf041.zip
Fix #1298 - Escape commands for PowerShell
Diffstat (limited to 'test/smoke_test.vader')
-rw-r--r--test/smoke_test.vader62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/smoke_test.vader b/test/smoke_test.vader
index 7635cbd9..f6d0be56 100644
--- a/test/smoke_test.vader
+++ b/test/smoke_test.vader
@@ -1,6 +1,7 @@
Before:
Save g:ale_set_lists_synchronously
Save g:ale_buffer_info
+ Save &shell
let g:ale_buffer_info = {}
let g:ale_set_lists_synchronously = 1
@@ -59,6 +60,67 @@ Execute(Linters should run with the default options):
\ 'valid': 1,
\ }], getloclist(0)
+Execute(Linters should run in PowerShell too):
+ if has('win32')
+ set shell=powershell
+
+ AssertEqual 'foobar', &filetype
+
+ " Replace the callback to handle two lines.
+ function! TestCallback(buffer, output)
+ " Windows adds extra spaces to the text from echo.
+ return [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 3,
+ \ 'text': substitute(a:output[0], ' *$', '', ''),
+ \ },
+ \ {
+ \ 'lnum': 2,
+ \ 'col': 3,
+ \ 'text': substitute(a:output[1], ' *$', '', ''),
+ \ },
+ \]
+ endfunction
+
+ " Recreate the command string to use &&, which PowerShell does not support.
+ call ale#linter#Reset()
+ call ale#linter#Define('foobar', {
+ \ 'name': 'testlinter',
+ \ 'callback': 'TestCallback',
+ \ 'executable': 'cmd',
+ \ 'command': 'echo foo && echo bar',
+ \})
+
+ call ale#Lint()
+ call ale#engine#WaitForJobs(2000)
+
+ AssertEqual [
+ \ {
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 1,
+ \ 'vcol': 0,
+ \ 'col': 3,
+ \ 'text': 'foo',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \ },
+ \ {
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 2,
+ \ 'vcol': 0,
+ \ 'col': 3,
+ \ 'text': 'bar',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \ },
+ \], getloclist(0)
+ endif
+
Execute(Previous errors should be removed when linters change):
call ale#Lint()
call ale#engine#WaitForJobs(2000)