2017-09-02 14:48:00 +00:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/slim/slimlint.vim
|
|
|
|
|
|
|
|
let g:default_command = 'slim-lint %t'
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! g:default_command
|
2017-10-05 21:31:00 +00:00
|
|
|
unlet! b:conf
|
2017-09-02 14:48:00 +00:00
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
|
|
|
Execute(The default command should be correct):
|
|
|
|
AssertEqual g:default_command, ale_linters#slim#slimlint#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The command should have the .rubocop.yml prepended as an env var if one exists):
|
|
|
|
call ale#test#SetFilename('../slimlint-test-files/subdir/file.slim')
|
|
|
|
|
2017-12-19 18:23:09 +00:00
|
|
|
let b:conf = ale#path#Simplify(g:dir . '/../slimlint-test-files/.rubocop.yml')
|
2017-10-05 21:31:00 +00:00
|
|
|
|
|
|
|
if has('win32')
|
|
|
|
" Windows uses 'set var=... && command'
|
|
|
|
AssertEqual
|
|
|
|
\ 'set SLIM_LINT_RUBOCOP_CONF='
|
|
|
|
\ . ale#Escape(b:conf)
|
|
|
|
\ . ' && ' . g:default_command,
|
|
|
|
\ ale_linters#slim#slimlint#GetCommand(bufnr(''))
|
|
|
|
else
|
|
|
|
" Unix uses 'var=... command'
|
|
|
|
AssertEqual
|
|
|
|
\ 'SLIM_LINT_RUBOCOP_CONF='
|
|
|
|
\ . ale#Escape(b:conf)
|
|
|
|
\ . ' ' . g:default_command,
|
|
|
|
\ ale_linters#slim#slimlint#GetCommand(bufnr(''))
|
|
|
|
endif
|