summaryrefslogtreecommitdiff
path: root/test/test_perlcritic_linter.vader
blob: 8b7cf1a4a035d488bd96195a6a0ec51073d3119d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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(''))