summaryrefslogtreecommitdiff
path: root/test/handler/test_perl_handler.vader
blob: 9e1c520360c5811d8037e51bf59998d06a95b218 (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
Before:
  call ale#test#SetDirectory('/testplugin/test/handler')

  runtime ale_linters/perl/perl.vim

After:
  call ale#test#RestoreDirectory()
  call ale#linter#Reset()

Execute(The Perl linter should ignore errors from other files):
  call ale#test#SetFilename('bar.pl')

  AssertEqual
  \ [
  \    {'lnum': '2', 'type': 'E', 'text': 'Compilation failed in require'},
  \ ],
  \ ale_linters#perl#perl#Handle(bufnr(''), [
  \   'syntax error at ' . ale#path#Winify(g:dir . '/foo.pm') . ' line 4, near "aklsdfjmy "',
  \   'Compilation failed in require at ' . ale#path#Winify(g:dir . '/bar.pl') . ' line 2.',
  \   'BEGIN failed--compilation aborted at ' . ale#path#Winify(g:dir . '/bar.pl') . ' line 2.',
  \ ])

Execute(The Perl linter should complain about failing to locate modules):
  AssertEqual
  \ [
  \    {
  \     'lnum': '23',
  \     'type': 'E',
  \     'text': 'Can''t locate JustOneDb.pm in @INC (you may need to install the JustOneDb module) (@INC contains: /home/local/sean/work/PostgreSQL/6616/../../../../lib /home/local/sean/work/PostgreSQL/6616/lib lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .)',
  \   },
  \ ],
  \ ale_linters#perl#perl#Handle(bufnr(''), [
  \ 'Can''t locate JustOneDb.pm in @INC (you may need to install the JustOneDb module) (@INC contains: /home/local/sean/work/PostgreSQL/6616/../../../../lib /home/local/sean/work/PostgreSQL/6616/lib lib /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at - line 23.',
  \ 'BEGIN failed--compilation aborted at - line 23.',
  \ ])


Execute(The Perl linter should complain about failing to locate modules):
  AssertEqual
  \ [
  \ {'lnum': '8', 'type': 'E', 'text': 'BEGIN failed--compilation aborted'},
  \ {'lnum': '10', 'type': 'E', 'text': 'BEGIN failed--compilation aborted'}
  \ ],
  \ ale_linters#perl#perl#Handle(bufnr(''), [
  \ 'Unable to build `ro` accessor for slot `path` in `App::CPANFileUpdate` because the slot cannot be found. at /extlib/Method/Traits.pm line 189.',
  \ 'BEGIN failed--compilation aborted at - line 8.',
  \ 'Unable to build `ro` accessor for slot `path` in `App::CPANFileUpdate` because the slot cannot be found. at /extlib/Method/Traits.pm line 189.',
  \ 'BEGIN failed--compilation aborted at - line 10.',
  \ ])