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
1 changed files with 31 additions and 26 deletions

View File

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