From 0ad254799781ba1e00b13b26dfbee5c6fed9684f Mon Sep 17 00:00:00 2001 From: w0rp Date: Tue, 19 Dec 2017 17:34:34 +0000 Subject: Fix mcsc paths and escaping for Windows --- .../test_cs_mcsc_command_callbacks.vader | 32 ++++++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'test/command_callback') diff --git a/test/command_callback/test_cs_mcsc_command_callbacks.vader b/test/command_callback/test_cs_mcsc_command_callbacks.vader index 441cef53..cb52c969 100644 --- a/test/command_callback/test_cs_mcsc_command_callbacks.vader +++ b/test/command_callback/test_cs_mcsc_command_callbacks.vader @@ -12,6 +12,8 @@ Before: unlet! g:ale_cs_mcsc_assembly_path unlet! g:ale_cs_mcsc_assemblies + let g:prefix = ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs') + function! GetCommand() let l:command = ale_linters#cs#mcsc#GetCommand(bufnr('')) let l:command = join(split(l:command)) @@ -28,52 +30,64 @@ After: unlet! g:ale_cs_mcsc_source unlet! g:ale_cs_mcsc_assembly_path unlet! g:ale_cs_mcsc_assemblies + unlet! g:ale_prefix delfunction GetCommand call ale#linter#Reset() -Execute(Check for proper default command): +Execute(The mcsc linter should return the correct default command): AssertEqual - \ 'cd ".";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"', + \ ale#path#BufferCdString(bufnr('')) + \ . 'mcs -unsafe' . g:prefix, \ GetCommand() Execute(The options should be be used in the command): let g:ale_cs_mcsc_options = '-pkg:dotnet' AssertEqual - \ 'cd ".";mcs -unsafe ' . g:ale_cs_mcsc_options . ' -out:TEMP -t:module -recurse:"*.cs"', + \ ale#path#BufferCdString(bufnr('')) + \ . 'mcs -unsafe -pkg:dotnet' . g:prefix, \ GetCommand() Execute(The souce path should be be used in the command): - let g:ale_cs_mcsc_source='../foo/bar' + let g:ale_cs_mcsc_source = '../foo/bar' AssertEqual - \ 'cd "' . g:ale_cs_mcsc_source . '";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"', + \ 'cd ' . ale#Escape('../foo/bar') . ' && ' + \ . 'mcs -unsafe' . g:prefix, \ GetCommand() Execute(The list of search pathes for assemblies should be be used in the command if not empty): let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar'] AssertEqual - \ 'cd ".";mcs -unsafe -lib:"' . join(g:ale_cs_mcsc_assembly_path,'","') . '" -out:TEMP -t:module -recurse:"*.cs"', + \ ale#path#BufferCdString(bufnr('')) + \ . 'mcs -unsafe' + \ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar') + \ . g:prefix, \ GetCommand() let g:ale_cs_mcsc_assembly_path = [] AssertEqual - \ 'cd ".";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"', + \ ale#path#BufferCdString(bufnr('')) + \ . 'mcs -unsafe' . g:prefix, \ GetCommand() Execute(The list of assemblies should be be used in the command if not empty): let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll'] AssertEqual - \ 'cd ".";mcs -unsafe -r:"' . join(g:ale_cs_mcsc_assemblies,'","') . '" -out:TEMP -t:module -recurse:"*.cs"', + \ ale#path#BufferCdString(bufnr('')) + \ . 'mcs -unsafe' + \ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll') + \ . g:prefix, \ GetCommand() let g:ale_cs_mcsc_assemblies = [] AssertEqual - \ 'cd ".";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"', + \ ale#path#BufferCdString(bufnr('')) + \ . 'mcs -unsafe' . g:prefix, \ GetCommand() -- cgit v1.2.3