Add an AssertLinter command for tests

This commit is contained in:
w0rp
2018-07-06 22:46:36 +01:00
parent 344e0fec97
commit 4999ad7e78
4 changed files with 80 additions and 27 deletions

View File

@@ -1,4 +1,6 @@
Before:
call ale#assert#Init()
Save g:ale_typescript_tslint_executable
Save g:ale_typescript_tslint_config_path
Save g:ale_typescript_tslint_rules_dir
@@ -26,26 +28,25 @@ After:
call ale#linter#Reset()
Execute(The default tslint command should be correct):
AssertEqual
AssertLinter
\ 'tslint',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('tslint') . ' --format json %t',
\ ale_linters#typescript#tslint#GetCommand(bufnr(''))
\ . ale#Escape('tslint') . ' --format json %t'
Execute(The rules directory option should be included if set):
let b:ale_typescript_tslint_rules_dir = '/foo/bar'
AssertEqual
AssertLinter
\ 'tslint',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('tslint') . ' --format json'
\ . ' -r ' . ale#Escape('/foo/bar')
\ . ' %t',
\ ale_linters#typescript#tslint#GetCommand(bufnr(''))
\ . ' %t'
Execute(The executable should be configurable and escaped):
let b:ale_typescript_tslint_executable = 'foo bar'
AssertEqual 'foo bar', ale_linters#typescript#tslint#GetExecutable(bufnr(''))
AssertEqual
AssertLinter
\ 'foo bar',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . ale#Escape('foo bar') . ' --format json %t',
\ ale_linters#typescript#tslint#GetCommand(bufnr(''))
\ . ale#Escape('foo bar') . ' --format json %t'