2017-09-26 07:19:53 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_cs_mcsc_source
|
|
|
|
|
|
|
|
unlet! g:ale_cs_mcsc_source
|
|
|
|
|
2018-03-02 20:47:13 +00:00
|
|
|
call ale#test#SetDirectory('/testplugin/test/handler')
|
2018-03-02 20:57:55 +00:00
|
|
|
call ale#test#SetFilename('Test.cs')
|
2018-03-02 20:47:13 +00:00
|
|
|
|
2017-09-26 07:19:53 +00:00
|
|
|
runtime ale_linters/cs/mcsc.vim
|
|
|
|
|
|
|
|
After:
|
|
|
|
unlet! g:ale_cs_mcsc_source
|
2018-03-02 20:47:13 +00:00
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
2017-09-26 07:19:53 +00:00
|
|
|
call ale#linter#Reset()
|
|
|
|
|
2017-12-19 17:34:34 +00:00
|
|
|
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',
|
2018-03-02 20:47:13 +00:00
|
|
|
\ 'filename': ale#path#Simplify(g:dir . '/Test.cs'),
|
2017-12-19 17:34:34 +00:00
|
|
|
\ },
|
|
|
|
\ ],
|
2018-03-02 20:57:55 +00:00
|
|
|
\ ale_linters#cs#mcsc#Handle(bufnr(''), [
|
2017-12-19 17:34:34 +00:00
|
|
|
\ 'Test.cs(12,29): error CS1001: ; expected',
|
|
|
|
\ 'Compilation failed: 2 error(s), 1 warnings',
|
|
|
|
\ ])
|
|
|
|
|
2017-09-26 07:19:53 +00:00
|
|
|
Execute(The mcs handler should handle cannot find symbol errors):
|
2017-12-19 17:34:34 +00:00
|
|
|
let g:ale_cs_mcsc_source = '/home/foo/project/bar'
|
2017-09-26 07:19:53 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 12,
|
|
|
|
\ 'col' : 29,
|
2017-11-19 00:19:09 +00:00
|
|
|
\ 'text': '; expected',
|
|
|
|
\ 'code': 'CS1001',
|
2017-09-26 07:19:53 +00:00
|
|
|
\ 'type': 'E',
|
2017-12-19 18:23:09 +00:00
|
|
|
\ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'),
|
2017-09-26 07:19:53 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 101,
|
|
|
|
\ 'col': 0,
|
2017-11-19 00:19:09 +00:00
|
|
|
\ 'text': 'Unexpected processor directive (no #if for this #endif)',
|
|
|
|
\ 'code': 'CS1028',
|
2017-09-26 07:19:53 +00:00
|
|
|
\ 'type': 'E',
|
2017-12-19 18:23:09 +00:00
|
|
|
\ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'),
|
2017-09-26 07:19:53 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 10,
|
|
|
|
\ 'col': 12,
|
2017-11-19 00:19:09 +00:00
|
|
|
\ 'text': 'some warning',
|
|
|
|
\ 'code': 'CS0123',
|
2017-09-26 07:19:53 +00:00
|
|
|
\ 'type': 'W',
|
2017-12-19 18:23:09 +00:00
|
|
|
\ 'filename': ale#path#Simplify('/home/foo/project/bar/Test.cs'),
|
2017-09-26 07:19:53 +00:00
|
|
|
\ },
|
|
|
|
\ ],
|
2018-03-02 20:57:55 +00:00
|
|
|
\ ale_linters#cs#mcsc#Handle(bufnr(''), [
|
2017-09-26 07:19:53 +00:00
|
|
|
\ 'Test.cs(12,29): error CS1001: ; expected',
|
|
|
|
\ 'Test.cs(101,0): error CS1028: Unexpected processor directive (no #if for this #endif)',
|
|
|
|
\ 'Test.cs(10,12): warning CS0123: some warning',
|
|
|
|
\ 'Compilation failed: 2 error(s), 1 warnings',
|
|
|
|
\ ])
|
2019-07-02 07:18:17 +00:00
|
|
|
|
|
|
|
Execute(The mcsc handler should handle non file specific compiler errors without reporting overal status report as error):
|
|
|
|
let g:ale_cs_mcsc_source = '/home/foo/project/bar'
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': -1,
|
|
|
|
\ 'col' : -1,
|
|
|
|
\ 'text': 'No files to compile were specified',
|
|
|
|
\ 'code': 'CS2008',
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'filename': '<mcs>',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#cs#mcsc#Handle(bufnr(''), [
|
|
|
|
\ 'error CS2008: No files to compile were specified',
|
|
|
|
\ 'Compilation failed: 1 error(s), 0 warnings',
|
|
|
|
\ ])
|