1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
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
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
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
delfunction GetCommand
call ale#linter#Reset()
Execute(Check for proper default command):
AssertEqual
\ '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'
AssertEqual
\ '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):
let g:ale_cs_mcsc_source='../foo/bar'
AssertEqual
\ '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):
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"',
\ GetCommand()
let g:ale_cs_mcsc_assembly_path = []
AssertEqual
\ '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):
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"',
\ GetCommand()
let g:ale_cs_mcsc_assemblies = []
AssertEqual
\ 'cd ".";mcs -unsafe -out:TEMP -t:module -recurse:"*.cs"',
\ GetCommand()
|