summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-12-18 12:01:05 +0000
committerw0rp <devw0rp@gmail.com>2017-12-18 12:01:05 +0000
commit31241e9ed89ddad6c015d0f9ca9bb8a4de80332e (patch)
tree5df90fb53686217da17fa13cc34c655285aa6182
parente0c3cbd16f2e29464667d7bf56936312f712185a (diff)
downloadale-31241e9ed89ddad6c015d0f9ca9bb8a4de80332e.zip
Get the TSLint tempname test running on Windows
-rw-r--r--test/handler/test_tslint_handler.vader57
1 files changed, 31 insertions, 26 deletions
diff --git a/test/handler/test_tslint_handler.vader b/test/handler/test_tslint_handler.vader
index 4c551dc3..bbaef837 100644
--- a/test/handler/test_tslint_handler.vader
+++ b/test/handler/test_tslint_handler.vader
@@ -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,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):
- 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.
- AssertEqual
- \ [
- \ {'lnum': 47, 'col': 1, 'code': 'curly', 'end_lnum': 47, 'type': 'E', 'end_col': 26, 'text': 'if statements must be braced'},
- \ ],
- \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
- \ {
- \ 'endPosition': {
- \ 'character':25,
- \ 'line':46,
- \ 'position':1383,
- \ },
- \ 'failure': 'if statements must be braced',
- \ 'name': substitute(substitute(substitute(expand('%:p'), '[^/\\]', '', 'g'), '.', '../', 'g') . tempname(), '\([A-Z]:\\\)[A-Z]:', '\1', ''),
- \ 'ruleName': 'curly',
- \ 'ruleSeverity':'ERROR',
- \ 'startPosition': {
- \ 'character':0,
- \ 'line':46,
- \ 'position':1358,
- \ }
- \ },
- \ ])])
- endif
+ " 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'},
+ \ ],
+ \ ale_linters#typescript#tslint#Handle(bufnr(''), [json_encode([
+ \ {
+ \ 'endPosition': {
+ \ 'character':25,
+ \ 'line':46,
+ \ 'position':1383,
+ \ },
+ \ 'failure': 'if statements must be braced',
+ \ 'name': b:relative_tempname,
+ \ 'ruleName': 'curly',
+ \ 'ruleSeverity':'ERROR',
+ \ 'startPosition': {
+ \ 'character':0,
+ \ 'line':46,
+ \ 'position':1358,
+ \ }
+ \ },
+ \ ])])