Get the mcsc handler tests to pass on Windows

This commit is contained in:
w0rp 2017-10-01 17:36:47 +01:00
parent c76f721b59
commit 5731616cd2
2 changed files with 15 additions and 7 deletions

View file

@ -9,14 +9,22 @@ endfunction
" This function is mainly used for testing.
" Simplify() a path, and change forward slashes to back slashes on Windows.
function! ale#path#Winify(path) abort
let l:simplified_path = ale#path#Simplify(a:path)
"
" If an additional 'add_drive' argument is given, the current drive letter
" will be prefixed to any absolute paths on Windows.
function! ale#path#Winify(path, ...) abort
let l:new_path = ale#path#Simplify(a:path)
if has('win32')
return substitute(l:simplified_path, '/', '\\', 'g')
let l:new_path = substitute(l:new_path, '/', '\\', 'g')
" Add a drive letter to \foo\bar paths, if needed.
if a:0 && a:1 is# 'add_drive' && l:new_path[:0] is# '\'
let l:new_path = fnamemodify('.', ':p')[:1] . l:new_path
endif
endif
return l:simplified_path
return l:new_path
endfunction
" Given a buffer and a filename, find the nearest file by searching upwards

View file

@ -19,21 +19,21 @@ Execute(The mcs handler should handle cannot find symbol errors):
\ 'col' : 29,
\ 'text': 'error CS1001: ; expected',
\ 'type': 'E',
\ 'filename': '/home/foo/project/bar/Test.cs'
\ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 101,
\ 'col': 0,
\ 'text': 'error CS1028: Unexpected processor directive (no #if for this #endif)',
\ 'type': 'E',
\ 'filename': '/home/foo/project/bar/Test.cs'
\ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ {
\ 'lnum': 10,
\ 'col': 12,
\ 'text': 'warning CS0123: some warning',
\ 'type': 'W',
\ 'filename': '/home/foo/project/bar/Test.cs'
\ 'filename': ale#path#Winify('/home/foo/project/bar/Test.cs', 'add_drive'),
\ },
\ ],
\ ale_linters#cs#mcsc#Handle(347, [