Get the TSLint tempname test running on Windows

This commit is contained in:
w0rp 2017-12-18 12:01:05 +00:00
parent e0c3cbd16f
commit 31241e9ed8

View File

@ -12,6 +12,9 @@ After:
Restore
unlet! b:ale_typescript_tslint_ignore_empty_files
unlet! b:relative_to_root
unlet! b:tempname_suffix
unlet! b:relative_tempname
call ale#test#RestoreDirectory()
call ale#linter#Reset()
@ -282,9 +285,12 @@ Execute(The tslint handler should not report no-implicit-dependencies errors):
\ }])])
Execute(The tslint handler should set filename keys for temporary files):
if !has('win32')
" The temporay filename below is hacked into being a relative path so we can
" test that we resolve the temporary filename first.
let b:relative_to_root = substitute(expand('%:p'), '\v[^/\\]*([/\\])[^/\\]*', has('win32') ? '..\' : '../', 'g')
let b:tempname_suffix = substitute(tempname(), '^\v([A-Z]:)?[/\\]', '', '')
let b:relative_tempname = b:relative_to_root . b:tempname_suffix
AssertEqual
\ [
\ {'lnum': 47, 'col': 1, 'code': 'curly', 'end_lnum': 47, 'type': 'E', 'end_col': 26, 'text': 'if statements must be braced'},
@ -297,7 +303,7 @@ Execute(The tslint handler should set filename keys for temporary files):
\ 'position':1383,
\ },
\ 'failure': 'if statements must be braced',
\ 'name': substitute(substitute(substitute(expand('%:p'), '[^/\\]', '', 'g'), '.', '../', 'g') . tempname(), '\([A-Z]:\\\)[A-Z]:', '\1', ''),
\ 'name': b:relative_tempname,
\ 'ruleName': 'curly',
\ 'ruleSeverity':'ERROR',
\ 'startPosition': {
@ -307,4 +313,3 @@ Execute(The tslint handler should set filename keys for temporary files):
\ }
\ },
\ ])])
endif