2017-09-10 23:47:27 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_perl_perlcritic_profile
|
|
|
|
Save g:ale_perl_perlcritic_options
|
|
|
|
Save g:ale_perl_perlcritic_executable
|
|
|
|
Save g:ale_perl_perlcritic_showrules
|
|
|
|
|
|
|
|
unlet! g:ale_perl_perlcritic_options
|
|
|
|
unlet! g:ale_perl_perlcritic_executable
|
|
|
|
unlet! g:ale_perl_perlcritic_showrules
|
|
|
|
let g:ale_perl_perlcritic_profile = ''
|
|
|
|
|
|
|
|
runtime ale_linters/perl/perlcritic.vim
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
|
|
|
call ale#test#SetFilename('test.pl')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! b:ale_perl_perlcritic_profile
|
|
|
|
unlet! b:ale_perl_perlcritic_options
|
|
|
|
unlet! b:ale_perl_perlcritic_executable
|
|
|
|
unlet! b:ale_perl_perlcritic_showrules
|
|
|
|
unlet! b:readme_path
|
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The command should be correct with g:ale_perl_perlcritic_showrules off):
|
|
|
|
let b:ale_perl_perlcritic_showrules = 0
|
|
|
|
|
|
|
|
AssertEqual
|
2018-05-28 11:51:06 +00:00
|
|
|
\ ale#Escape('perlcritic')
|
|
|
|
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
|
|
|
\ . ' --nocolor',
|
2017-09-10 23:47:27 +00:00
|
|
|
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The command should be correct with g:ale_perl_perlcritic_showrules on):
|
|
|
|
let b:ale_perl_perlcritic_showrules = 1
|
|
|
|
|
|
|
|
AssertEqual
|
2018-05-28 11:51:06 +00:00
|
|
|
\ ale#Escape('perlcritic')
|
|
|
|
\ . ' --verbose ' . ale#Escape('%l:%c %m [%p]\n')
|
|
|
|
\ . ' --nocolor',
|
2017-09-10 23:47:27 +00:00
|
|
|
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The command search for the profile file when set):
|
|
|
|
let b:ale_perl_perlcritic_profile = 'README.md'
|
|
|
|
|
2017-12-19 18:23:09 +00:00
|
|
|
let b:readme_path = ale#path#Simplify(expand('%:p:h:h:h') . '/README.md')
|
2017-09-10 23:47:27 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2018-05-28 11:51:06 +00:00
|
|
|
\ ale#Escape('perlcritic')
|
|
|
|
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
|
|
|
\ . ' --nocolor'
|
2017-09-10 23:47:27 +00:00
|
|
|
\ . ' --profile ' . ale#Escape(b:readme_path),
|
|
|
|
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(Extra options should be set appropriately):
|
|
|
|
let b:ale_perl_perlcritic_options = 'beep boop'
|
|
|
|
|
|
|
|
AssertEqual
|
2018-05-28 11:51:06 +00:00
|
|
|
\ ale#Escape('perlcritic')
|
|
|
|
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
|
|
|
\ . ' --nocolor'
|
2017-09-10 23:47:27 +00:00
|
|
|
\ . ' beep boop',
|
|
|
|
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|