summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_cs_mcsc_command_callbacks.vader32
-rw-r--r--test/handler/test_mcsc_handler.vader19
2 files changed, 41 insertions, 10 deletions
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()
diff --git a/test/handler/test_mcsc_handler.vader b/test/handler/test_mcsc_handler.vader
index a0007926..d97a2edc 100644
--- a/test/handler/test_mcsc_handler.vader
+++ b/test/handler/test_mcsc_handler.vader
@@ -9,8 +9,25 @@ After:
unlet! g:ale_cs_mcsc_source
call ale#linter#Reset()
+Execute(The mcs handler should work with the default of the buffer's directory):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 12,
+ \ 'col' : 29,
+ \ 'text': '; expected',
+ \ 'code': 'CS1001',
+ \ 'type': 'E',
+ \ 'filename': ale#path#Winify(expand('%:p:h') . '/Test.cs', 'add_drive'),
+ \ },
+ \ ],
+ \ ale_linters#cs#mcsc#Handle(347, [
+ \ 'Test.cs(12,29): error CS1001: ; expected',
+ \ 'Compilation failed: 2 error(s), 1 warnings',
+ \ ])
+
Execute(The mcs handler should handle cannot find symbol errors):
- let g:ale_cs_mcsc_source='/home/foo/project/bar'
+ let g:ale_cs_mcsc_source = '/home/foo/project/bar'
AssertEqual
\ [