diff options
author | Chris Weyl <chris@weyl.io> | 2017-06-29 07:08:51 -0500 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-06-29 13:08:51 +0100 |
commit | 3f1cab3e7ee3d7e90062e32e7d8c9557077c08a8 (patch) | |
tree | a4871ee9fdd2ef91a2c825e26e12b12d25965f86 /test | |
parent | 411c6b5e9f8ecf367aaf487adf4e380251c44fa1 (diff) | |
download | ale-3f1cab3e7ee3d7e90062e32e7d8c9557077c08a8.zip |
Add profile, other options to the perlcritic linter (#675)
* Add profile, other options to the perlcritic linter
Diffstat (limited to 'test')
-rw-r--r-- | test/test_perlcritic_linter.vader | 62 | ||||
-rw-r--r-- | test/test_perlcritic_showrules.vader | 16 |
2 files changed, 62 insertions, 16 deletions
diff --git a/test/test_perlcritic_linter.vader b/test/test_perlcritic_linter.vader new file mode 100644 index 00000000..8b7cf1a4 --- /dev/null +++ b/test/test_perlcritic_linter.vader @@ -0,0 +1,62 @@ +" NOTE: We use the 'b:' forms below to ensure that we're properly using +" ale#Var() + +Given perl: + #!/usr/bin/env perl + use v5.10; + say 'Hi there!'; + + +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 + silent! unlet g:ale_perl_perlcritic_options + silent! unlet g:ale_perl_perlcritic_executable + silent! unlet g:ale_perl_perlcritic_showrules + let g:ale_perl_perlcritic_profile = '' + + " enable loading inside test container + silent! cd /testplugin + source ale_linters/perl/perlcritic.vim + + +After: + Restore + silent! unlet b:ale_perl_perlcritic_profile + silent! unlet b:ale_perl_perlcritic_options + silent! unlet b:ale_perl_perlcritic_executable + silent! unlet b:ale_perl_perlcritic_showrules + + +Execute(no g:ale_perl_perlcritic_showrules): + let b:ale_perl_perlcritic_showrules = 0 + + AssertEqual + \ "'perlcritic' --verbose '". '%l:%c %m\n' . "' --nocolor", + \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) + + +Execute(yes g:ale_perl_perlcritic_showrules): + let b:ale_perl_perlcritic_showrules = 1 + + AssertEqual + \ "'perlcritic' --verbose '". '%l:%c %m [%p]\n' . "' --nocolor", + \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) + + +Execute(set g:ale_perl_perlcritic_profile): + let b:ale_perl_perlcritic_profile = 'README.md' + + Assert + \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) + \ =~# "--profile '.*/README.md'" + + +Execute(g:ale_perl_perlcritic_options): + let b:ale_perl_perlcritic_options = 'beep boop' + + AssertEqual + \ "'perlcritic' --verbose '". '%l:%c %m\n' . "' --nocolor beep boop", + \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) diff --git a/test/test_perlcritic_showrules.vader b/test/test_perlcritic_showrules.vader deleted file mode 100644 index 52089080..00000000 --- a/test/test_perlcritic_showrules.vader +++ /dev/null @@ -1,16 +0,0 @@ -Execute(no g:ale_perl_perlcritic_showrules): - silent noautocmd new testfile.pl - - let g:ale_perl_perlcritic_showrules = 0 - - AssertEqual - \ "perlcritic --verbose '". '%l:%c %m\n' . "' --nocolor", - \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) - - let g:ale_perl_perlcritic_showrules = 1 - - AssertEqual - \ "perlcritic --verbose '". '%l:%c %m [%p]\n' . "' --nocolor", - \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) - - :q |