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')
|
|
|
|
|
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
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#cs#mcsc#Handle(347, [
|
|
|
|
\ '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
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#cs#mcsc#Handle(347, [
|
|
|
|
\ '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',
|
|
|
|
\ ])
|