This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/test_perlcritic_linter.vader
Chris Weyl 3f1cab3e7e Add profile, other options to the perlcritic linter (#675)
* Add profile, other options to the perlcritic linter
2017-06-29 13:08:51 +01:00

62 lines
1.7 KiB
Text

" 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(''))