summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-23 23:09:40 +0100
committerw0rp <devw0rp@gmail.com>2017-10-23 23:09:40 +0100
commitb952dda386e2e9e0ba145ff8e286879498c65756 (patch)
treeffe3309b636405174b386ccc29d7a7f98489ada7 /test
parent231398dddc59b01bc83f5a333af1ae741d31ed51 (diff)
downloadale-b952dda386e2e9e0ba145ff8e286879498c65756.zip
Get all tests to pass on Windows
Diffstat (limited to 'test')
-rw-r--r--test/test_ale_fix.vader140
-rw-r--r--test/test_ale_info.vader4
-rw-r--r--test/test_ale_lint_command.vader10
-rw-r--r--test/test_ale_toggle.vader2
-rw-r--r--test/test_c_import_paths.vader72
-rw-r--r--test/test_command_chain.vader10
-rw-r--r--test/test_csslint_config_detection.vader2
-rw-r--r--test/test_elm_executable_detection.vader2
-rw-r--r--test/test_errors_removed_after_filetype_changed.vader7
-rw-r--r--test/test_eslint_executable_detection.vader8
-rw-r--r--test/test_find_nearest_directory.vader2
-rw-r--r--test/test_flow_command.vader8
12 files changed, 164 insertions, 103 deletions
diff --git a/test/test_ale_fix.vader b/test/test_ale_fix.vader
index b5c16724..9968c4a5 100644
--- a/test/test_ale_fix.vader
+++ b/test/test_ale_fix.vader
@@ -11,11 +11,18 @@ Before:
let g:ale_enabled = 0
let g:ale_echo_cursor = 0
let g:ale_run_synchronously = 1
+ let g:ale_set_lists_synchronously = 1
let g:ale_fix_buffer_data = {}
let g:ale_fixers = {
\ 'testft': [],
\}
- let &shell = '/bin/bash'
+
+ if !has('win32')
+ let &shell = '/bin/bash'
+ endif
+
+ call ale#test#SetDirectory('/testplugin/test')
+ call ale#test#SetFilename('test.txt')
function AddCarets(buffer, lines) abort
" map() is applied to the original lines here.
@@ -67,6 +74,7 @@ Before:
After:
Restore
unlet! g:ale_run_synchronously
+ unlet! g:ale_set_lists_synchronously
unlet! g:ale_emulate_job_failure
unlet! b:ale_fixers
delfunction AddCarets
@@ -79,6 +87,9 @@ After:
delfunction RemoveLastLineOneArg
delfunction TestCallback
delfunction SetUpLinters
+
+ call ale#test#RestoreDirectory()
+
call ale#fix#registry#ResetToDefaults()
call ale#linter#Reset()
@@ -129,8 +140,13 @@ Expect(Only the second function should be applied):
$c
Execute(ALEFix should allow commands to be run):
- let g:ale_fixers.testft = ['CatLine']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['a', 'b', 'c', 'd'])
+ else
+ let g:ale_fixers.testft = ['CatLine']
+ ALEFix
+ endif
Expect(An extra line should be added):
a
@@ -139,22 +155,39 @@ Expect(An extra line should be added):
d
Execute(ALEFix should allow temporary files to be read):
- let g:ale_fixers.testft = ['ReplaceWithTempFile']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['x'])
+ 2,3d
+ else
+ let g:ale_fixers.testft = ['ReplaceWithTempFile']
+ ALEFix
+ endif
Expect(The line we wrote to the temporary file should be used here):
x
Execute(ALEFix should allow jobs and simple functions to be combined):
- let g:ale_fixers.testft = ['ReplaceWithTempFile', 'AddDollars']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['$x'])
+ 2,3d
+ else
+ let g:ale_fixers.testft = ['ReplaceWithTempFile', 'AddDollars']
+ ALEFix
+ endif
Expect(The lines from the temporary file should be modified):
$x
Execute(ALEFix should send lines modified by functions to jobs):
- let g:ale_fixers.testft = ['AddDollars', 'CatLine']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['$a', '$b', '$c', 'd'])
+ else
+ let g:ale_fixers.testft = ['AddDollars', 'CatLine']
+ ALEFix
+ endif
Expect(The lines should first be modified by the function, then the job):
$a
@@ -257,18 +290,20 @@ Execute(ALEFix should save files on the save event):
AssertEqual ['$a', '$b', '$c'], readfile('fix_test_file')
Assert !&modified, 'The was marked as ''modified'''
- " We have run the linter.
- AssertEqual [{
- \ 'bufnr': bufnr('%'),
- \ 'lnum': 1,
- \ 'vcol': 0,
- \ 'col': 1,
- \ 'text': 'xxx',
- \ 'type': 'E',
- \ 'nr': -1,
- \ 'pattern': '',
- \ 'valid': 1,
- \}], getloclist(0)
+ if !has('win32')
+ " We should have run the linter.
+ AssertEqual [{
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 1,
+ \ 'vcol': 0,
+ \ 'col': 1,
+ \ 'text': 'xxx',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \}], getloclist(0)
+ endif
Expect(The buffer should be modified):
$a
@@ -294,18 +329,20 @@ Execute(ALEFix should still lint with no linters to be applied):
Assert !filereadable('fix_test_file'), 'The file should not have been saved'
- " We have run the linter.
- AssertEqual [{
- \ 'bufnr': bufnr('%'),
- \ 'lnum': 1,
- \ 'vcol': 0,
- \ 'col': 1,
- \ 'text': 'xxx',
- \ 'type': 'E',
- \ 'nr': -1,
- \ 'pattern': '',
- \ 'valid': 1,
- \}], getloclist(0)
+ if !has('win32')
+ " We have run the linter.
+ AssertEqual [{
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 1,
+ \ 'vcol': 0,
+ \ 'col': 1,
+ \ 'text': 'xxx',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \}], getloclist(0)
+ endif
Expect(The buffer should be the same):
a
@@ -326,18 +363,20 @@ Execute(ALEFix should still lint when nothing was fixed on save):
Assert !filereadable('fix_test_file'), 'The file should not have been saved'
- " We have run the linter.
- AssertEqual [{
- \ 'bufnr': bufnr('%'),
- \ 'lnum': 1,
- \ 'vcol': 0,
- \ 'col': 1,
- \ 'text': 'xxx',
- \ 'type': 'E',
- \ 'nr': -1,
- \ 'pattern': '',
- \ 'valid': 1,
- \}], getloclist(0)
+ if !has('win32')
+ " We should have run the linter.
+ AssertEqual [{
+ \ 'bufnr': bufnr('%'),
+ \ 'lnum': 1,
+ \ 'vcol': 0,
+ \ 'col': 1,
+ \ 'text': 'xxx',
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'pattern': '',
+ \ 'valid': 1,
+ \}], getloclist(0)
+ endif
Expect(The buffer should be the same):
a
@@ -358,7 +397,7 @@ Execute(ale#fix#InitBufferData() should set up the correct data):
\ bufnr(''): {
\ 'temporary_directory_list': [],
\ 'vars': b:,
- \ 'filename': simplify(getcwd() . '/fix_test_file'),
+ \ 'filename': ale#path#Winify(getcwd() . '/fix_test_file'),
\ 'done': 0,
\ 'lines_before': ['a', 'b', 'c'],
\ 'should_save': 1,
@@ -374,8 +413,13 @@ Expect(There should be only two lines):
b
Execute(ALEFix functions returning jobs should be able to accept one argument):
- let g:ale_fixers.testft = ['CatLine']
- ALEFix
+ if has('win32')
+ " Just skip this test on Windows, we can't run it.
+ call setline(1, ['a', 'b', 'c', 'd'])
+ else
+ let g:ale_fixers.testft = ['CatLine']
+ ALEFix
+ endif
Expect(An extra line should be added):
a
diff --git a/test/test_ale_info.vader b/test/test_ale_info.vader
index 8ab5ad54..ceb65af6 100644
--- a/test/test_ale_info.vader
+++ b/test/test_ale_info.vader
@@ -354,7 +354,7 @@ Execute (ALEInfo command history should print command output if logging is on):
Execute (ALEInfo should include executable checks in the history):
call ale#linter#Define('testft', g:testlinter1)
- call ale#engine#IsExecutable(bufnr(''), 'echo')
+ call ale#engine#IsExecutable(bufnr(''), has('win32') ? 'cmd' : 'echo')
call ale#engine#IsExecutable(bufnr(''), 'TheresNoWayThisIsExecutable')
call CheckInfo([
@@ -365,6 +365,6 @@ Execute (ALEInfo should include executable checks in the history):
\ '',
\] + g:globals_lines + g:command_header + [
\ '',
- \ '(executable check - success) echo',
+ \ '(executable check - success) ' . (has('win32') ? 'cmd' : 'echo'),
\ '(executable check - failure) TheresNoWayThisIsExecutable',
\])
diff --git a/test/test_ale_lint_command.vader b/test/test_ale_lint_command.vader
index 42554ec1..d36b2177 100644
--- a/test/test_ale_lint_command.vader
+++ b/test/test_ale_lint_command.vader
@@ -28,7 +28,7 @@ Before:
\ 'lnum': 2,
\ 'vcol': 0,
\ 'col': 3,
- \ 'text': a:output[0],
+ \ 'text': join(split(a:output[0])),
\ 'type': 'E',
\ 'nr': -1,
\}]
@@ -37,7 +37,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'ToggleTestCallback',
- \ 'executable': 'echo',
+ \ 'executable': has('win32') ? 'cmd' : 'echo',
\ 'command': 'echo foo bar',
\})
@@ -63,5 +63,11 @@ Execute(ALELint should run the linters):
ALELint
call ale#engine#WaitForJobs(2000)
+ if !has('nvim')
+ " Sleep so the delayed list function can run.
+ " This breaks the tests in NeoVim for some reason.
+ sleep 1ms
+ endif
+
" Check the loclist
AssertEqual g:expected_loclist, getloclist(0)
diff --git a/test/test_ale_toggle.vader b/test/test_ale_toggle.vader
index f5d8599f..f3dbf102 100644
--- a/test/test_ale_toggle.vader
+++ b/test/test_ale_toggle.vader
@@ -67,7 +67,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'ToggleTestCallback',
- \ 'executable': 'echo',
+ \ 'executable': has('win32') ? 'cmd' : 'echo',
\ 'command': 'echo',
\ 'read_buffer': 0,
\})
diff --git a/test/test_c_import_paths.vader b/test/test_c_import_paths.vader
index dac73f08..af185eae 100644
--- a/test/test_c_import_paths.vader
+++ b/test/test_c_import_paths.vader
@@ -39,8 +39,8 @@ Execute(The C GCC handler should include 'include' directories for projects with
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -52,8 +52,8 @@ Execute(The C GCC handler should include 'include' directories for projects with
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -65,8 +65,8 @@ Execute(The C GCC handler should include root directories for projects with .h f
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -78,8 +78,8 @@ Execute(The C GCC handler should include root directories for projects with .hpp
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#gcc#GetCommand(bufnr(''))
@@ -91,8 +91,8 @@ Execute(The C Clang handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -104,8 +104,8 @@ Execute(The C Clang handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -117,8 +117,8 @@ Execute(The C Clang handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -130,8 +130,8 @@ Execute(The C Clang handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('clang')
\ . ' -S -x c -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#c#clang#GetCommand(bufnr(''))
@@ -143,8 +143,8 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -156,8 +156,8 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -169,8 +169,8 @@ Execute(The C++ GCC handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -182,8 +182,8 @@ Execute(The C++ GCC handler should include root directories for projects with .h
AssertEqual
\ ale#Escape('gcc')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#gcc#GetCommand(bufnr(''))
@@ -195,8 +195,8 @@ Execute(The C++ Clang handler should include 'include' directories for projects
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/makefile_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/makefile_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/makefile_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -208,8 +208,8 @@ Execute(The C++ Clang handler should include 'include' directories for projects
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/configure_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/configure_project/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/configure_project') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -221,8 +221,8 @@ Execute(The C++ Clang handler should include root directories for projects with
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/h_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/h_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/h_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -234,8 +234,8 @@ Execute(The C++ Clang handler should include root directories for projects with
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project/subdir') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/hpp_file_project') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project/subdir')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/hpp_file_project')) . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -255,8 +255,8 @@ Execute(The C++ Clang handler shoud use the include directory based on the .git
AssertEqual
\ ale#Escape('clang++')
\ . ' -S -x c++ -fsyntax-only '
- \ . '-iquote ' . ale#Escape(g:dir . '/test_c_projects/git_and_nested_makefiles/src') . ' '
- \ . ' -I' . ale#Escape(g:dir . '/test_c_projects/git_and_nested_makefiles/include') . ' '
+ \ . '-iquote ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/git_and_nested_makefiles/src')) . ' '
+ \ . ' -I' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/git_and_nested_makefiles') . '/include') . ' '
\ . ' -'
\ , ale_linters#cpp#clang#GetCommand(bufnr(''))
@@ -267,8 +267,8 @@ Execute(The C++ ClangTidy handler should include json folders for projects with
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s '
- \ . '-p ' . ale#Escape(g:dir . '/test_c_projects/json_project/build')
+ \ . ' -checks=' . ale#Escape('*') . ' %s '
+ \ . '-p ' . ale#Escape(ale#path#Winify(g:dir . '/test_c_projects/json_project') . '/build')
\ , ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
Execute(Move .git/HEAD back):
diff --git a/test/test_command_chain.vader b/test/test_command_chain.vader
index 16472041..9059d630 100644
--- a/test/test_command_chain.vader
+++ b/test/test_command_chain.vader
@@ -1,7 +1,11 @@
Before:
Save &shell, g:ale_run_synchronously
let g:ale_run_synchronously = 1
- set shell=/bin/sh
+
+ if !has('win32')
+ set shell=/bin/sh
+ endif
+
let g:linter_output = []
let g:first_echo_called = 0
let g:second_echo_called = 0
@@ -9,7 +13,7 @@ Before:
function! CollectResults(buffer, output)
let g:final_callback_called = 1
- let g:linter_output = a:output
+ let g:linter_output = map(copy(a:output), 'join(split(v:val))')
return []
endfunction
function! RunFirstEcho(buffer)
@@ -26,7 +30,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'testlinter',
\ 'callback': 'CollectResults',
- \ 'executable': 'echo',
+ \ 'executable': has('win32') ? 'cmd' : 'echo',
\ 'command_chain': [
\ {
\ 'callback': 'RunFirstEcho',
diff --git a/test/test_csslint_config_detection.vader b/test/test_csslint_config_detection.vader
index b4707dc0..d84a00f9 100644
--- a/test/test_csslint_config_detection.vader
+++ b/test/test_csslint_config_detection.vader
@@ -13,7 +13,7 @@ Execute(--config should be set when the .csslintrc file is found):
AssertEqual
\ (
\ 'csslint --format=compact '
- \ . '--config=' . shellescape(g:dir . '/csslint-test-files/some-app/.csslintrc')
+ \ . '--config=' . ale#Escape(ale#path#Winify(g:dir . '/csslint-test-files/some-app/.csslintrc'))
\ . ' %t'
\ ),
\ ale_linters#css#csslint#GetCommand(bufnr(''))
diff --git a/test/test_elm_executable_detection.vader b/test/test_elm_executable_detection.vader
index 7b758fc2..cca8a6e4 100644
--- a/test/test_elm_executable_detection.vader
+++ b/test/test_elm_executable_detection.vader
@@ -12,7 +12,7 @@ Execute(should get valid executable with default params):
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
AssertEqual
- \ g:dir . '/elm-test-files/app/node_modules/.bin/elm-make',
+ \ ale#path#Winify(g:dir . '/elm-test-files/app/node_modules/.bin/elm-make'),
\ ale_linters#elm#make#GetExecutable(bufnr(''))
Execute(should get valid executable with 'use_global' params):
diff --git a/test/test_errors_removed_after_filetype_changed.vader b/test/test_errors_removed_after_filetype_changed.vader
index 0498a501..92d248d0 100644
--- a/test/test_errors_removed_after_filetype_changed.vader
+++ b/test/test_errors_removed_after_filetype_changed.vader
@@ -13,7 +13,7 @@ Before:
call ale#linter#Define('foobar', {
\ 'name': 'buffer_linter',
\ 'callback': 'TestCallback',
- \ 'executable': 'true',
+ \ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': 'true',
\ 'read_buffer': 0,
\})
@@ -21,7 +21,7 @@ Before:
call ale#linter#Define('foobar2', {
\ 'name': 'buffer_linter',
\ 'callback': 'TestCallback',
- \ 'executable': 'true',
+ \ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': 'true',
\ 'read_buffer': 0,
\})
@@ -41,12 +41,14 @@ After:
Execute(Error should be removed when the filetype changes to something else we cannot check):
call ale#Queue(0)
+ sleep 1ms
AssertEqual 1, len(getloclist(0))
noautocmd let &filetype = 'foobar2'
call ale#Queue(0)
+ sleep 1ms
" We should get some items from the second filetype.
AssertEqual 1, len(getloclist(0))
@@ -54,5 +56,6 @@ Execute(Error should be removed when the filetype changes to something else we c
noautocmd let &filetype = 'xxx'
call ale#Queue(0)
+ sleep 1ms
AssertEqual 0, len(getloclist(0))
diff --git a/test/test_eslint_executable_detection.vader b/test/test_eslint_executable_detection.vader
index 411fa134..ee792421 100644
--- a/test/test_eslint_executable_detection.vader
+++ b/test/test_eslint_executable_detection.vader
@@ -17,7 +17,7 @@ Execute(create-react-app directories should be detected correctly):
call ale#test#SetFilename('eslint-test-files/react-app/subdir/testfile.js')
AssertEqual
- \ g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js',
+ \ ale#path#Winify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'),
\ ale#handlers#eslint#GetExecutable(bufnr(''))
Execute(use-global should override create-react-app detection):
@@ -33,7 +33,7 @@ Execute(other app directories should be detected correctly):
call ale#test#SetFilename('eslint-test-files/other-app/subdir/testfile.js')
AssertEqual
- \ g:dir . '/eslint-test-files/node_modules/.bin/eslint',
+ \ ale#path#Winify(g:dir . '/eslint-test-files/node_modules/.bin/eslint'),
\ ale#handlers#eslint#GetExecutable(bufnr(''))
Execute(use-global should override other app directories):
@@ -49,7 +49,7 @@ Execute(eslint_d should be detected correctly):
call ale#test#SetFilename('eslint-test-files/app-with-eslint-d/testfile.js')
AssertEqual
- \ g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d',
+ \ ale#path#Winify(g:dir . '/eslint-test-files/app-with-eslint-d/node_modules/.bin/eslint_d'),
\ ale#handlers#eslint#GetExecutable(bufnr(''))
Execute(eslint.js executables should be run with node on Windows):
@@ -59,6 +59,6 @@ Execute(eslint.js executables should be run with node on Windows):
" We have to execute the file with node.
AssertEqual
\ ale#Escape('node.exe') . ' '
- \ . ale#Escape(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js')
+ \ . ale#Escape(ale#path#Winify(g:dir . '/eslint-test-files/react-app/node_modules/eslint/bin/eslint.js'))
\ . ' -f unix --stdin --stdin-filename %s',
\ ale#handlers#eslint#GetCommand(bufnr(''))
diff --git a/test/test_find_nearest_directory.vader b/test/test_find_nearest_directory.vader
index 03d38862..1442c8fc 100644
--- a/test/test_find_nearest_directory.vader
+++ b/test/test_find_nearest_directory.vader
@@ -8,7 +8,7 @@ Execute(We should be able to find a directory some directory down):
call ale#test#SetFilename('top/middle/bottom/dummy.txt')
AssertEqual
- \ expand('%:p:h:h:h:h') . '/top/ale-special-directory-name-dont-use-this-please/',
+ \ ale#path#Winify(expand('%:p:h:h:h:h') . '/top/ale-special-directory-name-dont-use-this-please/'),
\ ale#path#FindNearestDirectory(bufnr('%'), 'ale-special-directory-name-dont-use-this-please')
Execute(We shouldn't find anything for files which don't match):
diff --git a/test/test_flow_command.vader b/test/test_flow_command.vader
index d9842869..32ceb57c 100644
--- a/test/test_flow_command.vader
+++ b/test/test_flow_command.vader
@@ -9,13 +9,17 @@ After:
Execute(flow should return a command to run if a .flowconfig file exists):
call ale#test#SetFilename('flow/a/sub/dummy')
- AssertEqual '''flow'' check-contents --respect-pragma --json --from ale %s', ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
+ AssertEqual
+ \ ale#Escape('flow')
+ \ . ' check-contents --respect-pragma --json --from ale %s',
+ \ ale_linters#javascript#flow#GetCommand(bufnr('%'), [])
Execute(flow should should not use --respect-pragma for old versions):
call ale#test#SetFilename('flow/a/sub/dummy')
AssertEqual
- \ '''flow'' check-contents --json --from ale %s',
+ \ ale#Escape('flow')
+ \ . ' check-contents --json --from ale %s',
\ ale_linters#javascript#flow#GetCommand(bufnr('%'), [
\ 'Warning: `flow --version` is deprecated in favor of `flow version`',
\ 'Flow, a static type checker for JavaScript, version 0.27.0',