summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-10-18 23:42:51 +0100
committerw0rp <devw0rp@gmail.com>2017-10-18 23:42:51 +0100
commit5292d2f3497604f526b05508d5891cf5d4b75c2b (patch)
treed845e2d451efcf6d453cf3a13585ccfeb6fbe590
parent81d993086eae20cd8d2871b62e8889e54cfa9187 (diff)
downloadale-5292d2f3497604f526b05508d5891cf5d4b75c2b.zip
Get more tests to pass on Windows
-rw-r--r--test/command_callback/test_brakeman_command_callback.vader4
-rw-r--r--test/command_callback/test_c_clang_tidy_command_callback.vader21
-rw-r--r--test/command_callback/test_c_cppcheck_command_callbacks.vader2
-rw-r--r--test/command_callback/test_clang_tidy_command_callback.vader16
-rw-r--r--test/command_callback/test_cpp_cppcheck_command_callbacks.vader2
-rw-r--r--test/command_callback/test_cs_mcsc_command_callbacks.vader103
-rw-r--r--test/command_callback/test_cuda_nvcc_command_callbacks.vader6
-rw-r--r--test/test_no_linting_on_write_quit.vader2
8 files changed, 61 insertions, 95 deletions
diff --git a/test/command_callback/test_brakeman_command_callback.vader b/test/command_callback/test_brakeman_command_callback.vader
index b97c5809..f98801b3 100644
--- a/test/command_callback/test_brakeman_command_callback.vader
+++ b/test/command_callback/test_brakeman_command_callback.vader
@@ -25,7 +25,7 @@ Execute(The brakeman command callback should find a valid Rails app root):
AssertEqual
\ 'brakeman -f json -q -p '
- \ . ale#Escape(simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
+ \ . ale#Escape(ale#path#Winify(g:dir . '/../ruby_fixtures/valid_rails_app')),
\ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
Execute(The brakeman command callback should include configured options):
@@ -35,5 +35,5 @@ Execute(The brakeman command callback should include configured options):
AssertEqual
\ 'brakeman -f json -q --combobulate -p '
- \ . ale#Escape(simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
+ \ . ale#Escape(ale#path#Winify(g:dir . '/../ruby_fixtures/valid_rails_app')),
\ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_c_clang_tidy_command_callback.vader b/test/command_callback/test_c_clang_tidy_command_callback.vader
index 722a14f1..6f75d777 100644
--- a/test/command_callback/test_c_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_c_clang_tidy_command_callback.vader
@@ -26,7 +26,7 @@ After:
Execute(The clangtidy command default should be correct):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s',
+ \ . ' -checks=' . ale#Escape('*') . ' %s',
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
Execute(You should be able to remove the -checks option for clang-tidy):
@@ -42,7 +42,7 @@ Execute(You should be able to set other checks for clang-tidy):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''-*,clang-analyzer-*'' %s',
+ \ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s',
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
Execute(You should be able to manually set compiler flags for clang-tidy):
@@ -50,7 +50,8 @@ Execute(You should be able to manually set compiler flags for clang-tidy):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -- -Wall',
+ \ . ' -checks=' . ale#Escape('*') . ' %s'
+ \ . ' -- -Wall',
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
\
Execute(The build directory should be configurable):
@@ -58,7 +59,8 @@ Execute(The build directory should be configurable):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -p ' . ale#Escape('/foo/bar'),
+ \ . ' -checks=' . ale#Escape('*') . ' %s'
+ \ . ' -p ' . ale#Escape('/foo/bar'),
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
Execute(The build directory setting should override the options):
@@ -67,7 +69,8 @@ Execute(The build directory setting should override the options):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -p ' . ale#Escape('/foo/bar'),
+ \ . ' -checks=' . ale#Escape('*') . ' %s'
+ \ . ' -p ' . ale#Escape('/foo/bar'),
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
Execute(The build directory should be ignored for header files):
@@ -78,14 +81,16 @@ Execute(The build directory should be ignored for header files):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -- -Wall',
+ \ . ' -checks=' . ale#Escape('*') . ' %s'
+ \ . ' -- -Wall',
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
\
call ale#test#SetFilename('test.h')
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -- -Wall',
+ \ . ' -checks=' . ale#Escape('*') . ' %s'
+ \ . ' -- -Wall',
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
Execute(The executable should be configurable):
@@ -93,5 +98,5 @@ Execute(The executable should be configurable):
AssertEqual
\ ale#Escape('foobar')
- \ . ' -checks=''*'' %s',
+ \ . ' -checks=' . ale#Escape('*') . ' %s',
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_c_cppcheck_command_callbacks.vader b/test/command_callback/test_c_cppcheck_command_callbacks.vader
index daf61fbd..e6fe1b7d 100644
--- a/test/command_callback/test_c_cppcheck_command_callbacks.vader
+++ b/test/command_callback/test_c_cppcheck_command_callbacks.vader
@@ -43,7 +43,7 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
AssertEqual
- \ 'cd ' . ale#Escape(g:dir . '/cppcheck_paths/one') . ' && '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/cppcheck_paths/one')) . ' && '
\ . ale#Escape('cppcheck')
\ . ' -q --language=c --project=compile_commands.json --enable=style %t',
\ ale_linters#c#cppcheck#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_clang_tidy_command_callback.vader b/test/command_callback/test_clang_tidy_command_callback.vader
index f9e5781c..f82efffe 100644
--- a/test/command_callback/test_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_clang_tidy_command_callback.vader
@@ -26,7 +26,7 @@ After:
Execute(The clangtidy command default should be correct):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s',
+ \ . ' -checks=' . ale#Escape('*') . ' %s',
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
Execute(You should be able to remove the -checks option for clang-tidy):
@@ -42,7 +42,7 @@ Execute(You should be able to set other checks for clang-tidy):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''-*,clang-analyzer-*'' %s',
+ \ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s',
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
Execute(You should be able to manually set compiler flags for clang-tidy):
@@ -50,7 +50,7 @@ Execute(You should be able to manually set compiler flags for clang-tidy):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -- -Wall',
+ \ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall',
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
\
Execute(The build directory should be configurable):
@@ -58,7 +58,7 @@ Execute(The build directory should be configurable):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -p ' . ale#Escape('/foo/bar'),
+ \ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar'),
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
Execute(The build directory setting should override the options):
@@ -67,7 +67,7 @@ Execute(The build directory setting should override the options):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -p ' . ale#Escape('/foo/bar'),
+ \ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar'),
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
Execute(The build directory should be ignored for header files):
@@ -78,14 +78,14 @@ Execute(The build directory should be ignored for header files):
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -- -Wall',
+ \ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall',
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
\
call ale#test#SetFilename('test.hpp')
AssertEqual
\ ale#Escape('clang-tidy')
- \ . ' -checks=''*'' %s -- -Wall',
+ \ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall',
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
Execute(The executable should be configurable):
@@ -93,5 +93,5 @@ Execute(The executable should be configurable):
AssertEqual
\ ale#Escape('foobar')
- \ . ' -checks=''*'' %s',
+ \ . ' -checks=' . ale#Escape('*') . ' %s',
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_cpp_cppcheck_command_callbacks.vader b/test/command_callback/test_cpp_cppcheck_command_callbacks.vader
index 18391184..f7b37d4f 100644
--- a/test/command_callback/test_cpp_cppcheck_command_callbacks.vader
+++ b/test/command_callback/test_cpp_cppcheck_command_callbacks.vader
@@ -43,7 +43,7 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
AssertEqual
- \ 'cd ' . ale#Escape(g:dir . '/cppcheck_paths/one') . ' && '
+ \ 'cd ' . ale#Escape(ale#path#Winify(g:dir . '/cppcheck_paths/one')) . ' && '
\ . ale#Escape('cppcheck')
\ . ' -q --language=c++ --project=compile_commands.json --enable=style %t',
\ ale_linters#cpp#cppcheck#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_cs_mcsc_command_callbacks.vader b/test/command_callback/test_cs_mcsc_command_callbacks.vader
index b513b655..441cef53 100644
--- a/test/command_callback/test_cs_mcsc_command_callbacks.vader
+++ b/test/command_callback/test_cs_mcsc_command_callbacks.vader
@@ -3,118 +3,77 @@ Before:
Save g:ale_cs_mcsc_source
Save g:ale_cs_mcsc_assembly_path
Save g:ale_cs_mcsc_assemblies
+ Save g:ale_buffer_info
+
+ let g:ale_buffer_info = {bufnr(''): {'temporary_file_list': []}}
unlet! g:ale_cs_mcsc_options
unlet! g:ale_cs_mcsc_source
unlet! g:ale_cs_mcsc_assembly_path
unlet! g:ale_cs_mcsc_assemblies
- let g:temppath = fnamemodify(tempname(), ':p:h')
- let g:temppathpattern = substitute(escape(g:temppath, '\\/.*$^~[]'), '[\\/]*$', '[\\\\/]\\+\\S\\+','')
- let g:sometempfile = fnamemodify(g:temppath .'/some_temp_file.tmp', ':p')
+ function! GetCommand()
+ let l:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
+ let l:command = join(split(l:command))
+
+ return substitute(l:command, ':[^ ]\+ -t:module', ':TEMP -t:module', '')
+ endfunction
runtime ale_linters/cs/mcsc.vim
After:
Restore
+
unlet! b:ale_cs_mcsc_options
unlet! g:ale_cs_mcsc_source
unlet! g:ale_cs_mcsc_assembly_path
unlet! g:ale_cs_mcsc_assemblies
- unlet! g:temppath
- unlet! g:temppathpattern
- unlet! g:sometempfile
- call ale#linter#Reset()
-Execute(Check for proper default command):
+ delfunction GetCommand
- let b:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
- let b:command = substitute(b:command, '-out:' . g:temppathpattern, '-out:' . g:sometempfile, '')
- let b:command = substitute(b:command, '\s\+', ' ', 'g')
+ call ale#linter#Reset()
+Execute(Check for proper default command):
AssertEqual
- \ b:command,
- \ 'cd ".";mcs -unsafe -out:' . g:sometempfile . ' -t:module -recurse:"*.cs"'
+ \ 'cd ".";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"',
+ \ GetCommand()
Execute(The options should be be used in the command):
-
let g:ale_cs_mcsc_options = '-pkg:dotnet'
- let b:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
- let b:command = substitute(b:command, '-out:' . g:temppathpattern, '-out:' . g:sometempfile, '')
- let b:command = substitute(b:command, '\s\+', ' ', 'g')
-
AssertEqual
- \ b:command,
- \ 'cd ".";mcs -unsafe ' . g:ale_cs_mcsc_options . ' -out:' . g:sometempfile . ' -t:module -recurse:"*.cs"'
+ \ 'cd ".";mcs -unsafe ' . g:ale_cs_mcsc_options . ' -out:TEMP -t:module -recurse:"*.cs"',
+ \ GetCommand()
Execute(The souce path should be be used in the command):
- call ale#engine#Cleanup(bufnr(''))
- call ale#engine#InitBufferInfo(bufnr(''))
-
let g:ale_cs_mcsc_source='../foo/bar'
- let b:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
- let b:command = substitute(b:command, '-out:' . g:temppathpattern, '-out:' . g:sometempfile, '')
- let b:command = substitute(b:command, '\s\+', ' ', 'g')
-
AssertEqual
- \ b:command,
- \ 'cd "' . g:ale_cs_mcsc_source . '";mcs -unsafe -out:' . g:sometempfile . ' -t:module -recurse:"*.cs"'
+ \ 'cd "' . g:ale_cs_mcsc_source . '";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"',
+ \ GetCommand()
Execute(The list of search pathes for assemblies should be be used in the command if not empty):
- call ale#engine#Cleanup(bufnr(''))
- call ale#engine#InitBufferInfo(bufnr(''))
-
- let g:ale_cs_mcsc_assembly_path = [
- \ '/usr/lib/mono',
- \ '../foo/bar'
- \]
-
- let b:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
- let b:command = substitute(b:command, '-out:' . g:temppathpattern, '-out:' . g:sometempfile, '')
- let b:command = substitute(b:command, '\s\+', ' ', 'g')
+ let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar']
AssertEqual
- \ b:command,
- \ 'cd ".";mcs -unsafe -lib:"' . join(g:ale_cs_mcsc_assembly_path,'","') . '" -out:' . g:sometempfile . ' -t:module -recurse:"*.cs"'
-
- let g:ale_cs_mcsc_assembly_path = [
- \]
+ \ 'cd ".";mcs -unsafe -lib:"' . join(g:ale_cs_mcsc_assembly_path,'","') . '" -out:TEMP -t:module -recurse:"*.cs"',
+ \ GetCommand()
- let b:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
- let b:command = substitute(b:command, '-out:' . g:temppathpattern, '-out:' . g:sometempfile, '')
- let b:command = substitute(b:command, '\s\+', ' ', 'g')
+ let g:ale_cs_mcsc_assembly_path = []
AssertEqual
- \ b:command,
- \ 'cd ".";mcs -unsafe -out:' . g:sometempfile . ' -t:module -recurse:"*.cs"'
+ \ 'cd ".";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"',
+ \ GetCommand()
Execute(The list of assemblies should be be used in the command if not empty):
- call ale#engine#Cleanup(bufnr(''))
- call ale#engine#InitBufferInfo(bufnr(''))
-
- let g:ale_cs_mcsc_assemblies = [
- \ 'foo.dll',
- \ 'bar.dll'
- \]
-
- let b:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
- let b:command = substitute(b:command, '-out:' . g:temppathpattern, '-out:' . g:sometempfile, '')
- let b:command = substitute(b:command,'\s\+',' ','g')
+ let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll']
AssertEqual
- \ b:command,
- \ 'cd ".";mcs -unsafe -r:"' . join(g:ale_cs_mcsc_assemblies,'","') . '" -out:' . g:sometempfile . ' -t:module -recurse:"*.cs"'
+ \ 'cd ".";mcs -unsafe -r:"' . join(g:ale_cs_mcsc_assemblies,'","') . '" -out:TEMP -t:module -recurse:"*.cs"',
+ \ GetCommand()
- let g:ale_cs_mcsc_assemblies = [
- \]
-
- let b:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
- let b:command = substitute(b:command, '-out:' . g:temppathpattern, '-out:' . g:sometempfile, '')
- let b:command = substitute(b:command,'\s\+',' ','g')
+ let g:ale_cs_mcsc_assemblies = []
AssertEqual
- \ b:command,
- \ 'cd ".";mcs -unsafe -out:' . g:sometempfile . ' -t:module -recurse:"*.cs"'
-
+ \ 'cd ".";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"',
+ \ GetCommand()
diff --git a/test/command_callback/test_cuda_nvcc_command_callbacks.vader b/test/command_callback/test_cuda_nvcc_command_callbacks.vader
index 88123e5d..af199d37 100644
--- a/test/command_callback/test_cuda_nvcc_command_callbacks.vader
+++ b/test/command_callback/test_cuda_nvcc_command_callbacks.vader
@@ -24,11 +24,13 @@ Execute(The executable should be configurable):
Execute(The executable should be used in the command):
AssertEqual
- \ ale#Escape('nvcc') . ' -cuda -std=c++11 %s -o /dev/null',
+ \ ale#Escape('nvcc') . ' -cuda -std=c++11 %s'
+ \ . ' -o ' . g:ale#util#nul_file,
\ ale_linters#cuda#nvcc#GetCommand(bufnr(''))
let b:ale_cuda_nvcc_executable = 'foobar'
AssertEqual
- \ ale#Escape('foobar') . ' -cuda -std=c++11 %s -o /dev/null',
+ \ ale#Escape('foobar') . ' -cuda -std=c++11 %s'
+ \ . ' -o ' . g:ale#util#nul_file,
\ ale_linters#cuda#nvcc#GetCommand(bufnr(''))
diff --git a/test/test_no_linting_on_write_quit.vader b/test/test_no_linting_on_write_quit.vader
index 271adf65..d3baeaa1 100644
--- a/test/test_no_linting_on_write_quit.vader
+++ b/test/test_no_linting_on_write_quit.vader
@@ -22,7 +22,7 @@ Before:
call ale#linter#Define('testft', {
\ 'name': 'testlinter',
\ 'callback': 'TestCallback',
- \ 'executable': 'true',
+ \ 'executable': has('win32') ? 'cmd' : 'true',
\ 'command': 'true',
\})