2017-09-26 07:19:53 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_cs_mcsc_options
|
|
|
|
Save g:ale_cs_mcsc_source
|
|
|
|
Save g:ale_cs_mcsc_assembly_path
|
|
|
|
Save g:ale_cs_mcsc_assemblies
|
2017-10-18 22:42:51 +00:00
|
|
|
Save g:ale_buffer_info
|
|
|
|
|
|
|
|
let g:ale_buffer_info = {bufnr(''): {'temporary_file_list': []}}
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-12-19 17:34:34 +00:00
|
|
|
let g:prefix = ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
|
|
|
|
2017-10-18 22:42:51 +00:00
|
|
|
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
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
runtime ale_linters/cs/mcsc.vim
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
2017-10-18 22:42:51 +00:00
|
|
|
|
2017-09-26 07:19:53 +00:00
|
|
|
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
|
2017-12-19 17:34:34 +00:00
|
|
|
unlet! g:ale_prefix
|
2017-09-26 07:19:53 +00:00
|
|
|
|
2017-10-18 22:42:51 +00:00
|
|
|
delfunction GetCommand
|
2017-09-26 07:19:53 +00:00
|
|
|
|
2017-10-18 22:42:51 +00:00
|
|
|
call ale#linter#Reset()
|
2017-09-26 07:19:53 +00:00
|
|
|
|
2017-12-19 17:34:34 +00:00
|
|
|
Execute(The mcsc linter should return the correct default command):
|
2017-09-26 07:19:53 +00:00
|
|
|
AssertEqual
|
2017-12-19 17:34:34 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . 'mcs -unsafe' . g:prefix,
|
2017-10-18 22:42:51 +00:00
|
|
|
\ GetCommand()
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
Execute(The options should be be used in the command):
|
|
|
|
let g:ale_cs_mcsc_options = '-pkg:dotnet'
|
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 17:34:34 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . 'mcs -unsafe -pkg:dotnet' . g:prefix,
|
2017-10-18 22:42:51 +00:00
|
|
|
\ GetCommand()
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
Execute(The souce path should be be used in the command):
|
2017-12-19 17:34:34 +00:00
|
|
|
let g:ale_cs_mcsc_source = '../foo/bar'
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 17:34:34 +00:00
|
|
|
\ 'cd ' . ale#Escape('../foo/bar') . ' && '
|
|
|
|
\ . 'mcs -unsafe' . g:prefix,
|
2017-10-18 22:42:51 +00:00
|
|
|
\ GetCommand()
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
Execute(The list of search pathes for assemblies should be be used in the command if not empty):
|
2017-10-18 22:42:51 +00:00
|
|
|
let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar']
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 17:34:34 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . 'mcs -unsafe'
|
|
|
|
\ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar')
|
|
|
|
\ . g:prefix,
|
2017-10-18 22:42:51 +00:00
|
|
|
\ GetCommand()
|
2017-09-26 07:19:53 +00:00
|
|
|
|
2017-10-18 22:42:51 +00:00
|
|
|
let g:ale_cs_mcsc_assembly_path = []
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 17:34:34 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . 'mcs -unsafe' . g:prefix,
|
2017-10-18 22:42:51 +00:00
|
|
|
\ GetCommand()
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
Execute(The list of assemblies should be be used in the command if not empty):
|
2017-10-18 22:42:51 +00:00
|
|
|
let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll']
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 17:34:34 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . 'mcs -unsafe'
|
|
|
|
\ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll')
|
|
|
|
\ . g:prefix,
|
2017-10-18 22:42:51 +00:00
|
|
|
\ GetCommand()
|
2017-09-26 07:19:53 +00:00
|
|
|
|
2017-10-18 22:42:51 +00:00
|
|
|
let g:ale_cs_mcsc_assemblies = []
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 17:34:34 +00:00
|
|
|
\ ale#path#BufferCdString(bufnr(''))
|
|
|
|
\ . 'mcs -unsafe' . g:prefix,
|
2017-10-18 22:42:51 +00:00
|
|
|
\ GetCommand()
|