]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/handler/test_perl_handler.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit 'a39f715c13be3352193ffd9c5b7536b8786eff64' as '.vim/bundle/vim-lsp'
[etc/vim.git] / .vim / bundle / ale / test / handler / test_perl_handler.vader
1 Before:
2   call ale#test#SetDirectory('/testplugin/test/handler')
3
4   runtime ale_linters/perl/perl.vim
5
6 After:
7   call ale#test#RestoreDirectory()
8   call ale#linter#Reset()
9
10 Execute(The Perl linter should handle empty output):
11   call ale#test#SetFilename('bar.pl')
12
13   AssertEqual [], ale_linters#perl#perl#Handle(bufnr(''), [])
14
15 Execute(The Perl linter should ignore errors from other files):
16   call ale#test#SetFilename('bar.pl')
17
18   AssertEqual
19   \ [
20   \    {'lnum': '2', 'type': 'E', 'text': 'Compilation failed in require'},
21   \ ],
22   \ ale_linters#perl#perl#Handle(bufnr(''), [
23   \   'syntax error at ' . ale#path#Simplify(g:dir . '/foo.pm') . ' line 4, near "aklsdfjmy "',
24   \   'Compilation failed in require at ' . ale#path#Simplify(g:dir . '/bar.pl') . ' line 2.',
25   \   'BEGIN failed--compilation aborted at ' . ale#path#Simplify(g:dir . '/bar.pl') . ' line 2.',
26   \ ])
27
28 Execute(The Perl linter should complain about failing to locate modules):
29   AssertEqual
30   \ [
31   \    {
32   \     'lnum': '23',
33   \     'type': 'E',
34   \     '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 .)',
35   \   },
36   \ ],
37   \ ale_linters#perl#perl#Handle(bufnr(''), [
38   \ '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.',
39   \ 'BEGIN failed--compilation aborted at - line 23.',
40   \ ])
41
42
43 Execute(The Perl linter should complain about failing to locate modules):
44   AssertEqual
45   \ [
46   \ {'lnum': '8', 'type': 'E', 'text': 'BEGIN failed--compilation aborted'},
47   \ {'lnum': '10', 'type': 'E', 'text': 'BEGIN failed--compilation aborted'}
48   \ ],
49   \ ale_linters#perl#perl#Handle(bufnr(''), [
50   \ 'Unable to build `ro` accessor for slot `path` in `App::CPANFileUpdate` because the slot cannot be found. at /extlib/Method/Traits.pm line 189.',
51   \ 'BEGIN failed--compilation aborted at - line 8.',
52   \ 'Unable to build `ro` accessor for slot `path` in `App::CPANFileUpdate` because the slot cannot be found. at /extlib/Method/Traits.pm line 189.',
53   \ 'BEGIN failed--compilation aborted at - line 10.',
54   \ ])
55
56 Execute(The Perl linter should not report warnings as errors):
57   AssertEqual
58   \ [
59   \ {'lnum': '5', 'type': 'W', 'text': '"my" variable $foo masks earlier declaration in same scope'},
60   \ ],
61   \ ale_linters#perl#perl#Handle(bufnr(''), [
62   \ '"my" variable $foo masks earlier declaration in same scope at - line 5.',
63   \ 't.pl syntax OK',
64   \ ])
65
66 Execute(The Perl linter does not default to reporting generic error):
67   AssertEqual
68   \ [
69   \ {'lnum': '8', 'type': 'E', 'text': 'Missing right curly or square bracket'},
70   \ ],
71   \ ale_linters#perl#perl#Handle(bufnr(''), [
72   \ 'Missing right curly or square bracket at - line 8, at end of line',
73   \ 'syntax error at - line 8, at EOF',
74   \ 'Execution of t.pl aborted due to compilation errors.',
75   \ ])
76
77 " The first "error" is actually a warning, but the current implementation
78 " doesn't have a good way of teasing out the warnings from amongst the
79 " errors.  If we're able to do this in future, then we'll want to switch
80 " the first "E" to a "W".
81
82 Execute(The Perl linter reports errors even when mixed with warnings):
83   AssertEqual
84   \ [
85   \ {'lnum': '5', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'},
86   \ {'lnum': '8', 'type': 'E', 'text': 'Missing right curly or square bracket'},
87   \ ],
88   \ ale_linters#perl#perl#Handle(bufnr(''), [
89   \ '"my" variable $foo masks earlier declaration in same scope at - line 5.',
90   \ 'Missing right curly or square bracket at - line 8, at end of line',
91   \ 'syntax error at - line 8, at EOF',
92   \ 'Execution of t.pl aborted due to compilation errors.',
93   \ ])
94
95 Execute(The Perl linter reports errors even when an additional file location is included):
96   AssertEqual
97   \ [
98   \ {'lnum': '5', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'},
99   \ {'lnum': '6', 'type': 'E', 'text': '"my" variable $foo masks earlier declaration in same scope'},
100   \ {'lnum': '11', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'},
101   \ {'lnum': '12', 'type': 'E', 'text': 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?)'},
102   \ ],
103   \ ale_linters#perl#perl#Handle(bufnr(''), [
104   \ '"my" variable $foo masks earlier declaration in same scope at - line 5.',
105   \ '"my" variable $foo masks earlier declaration in same scope at - line 6, at <DATA> line 1.',
106   \ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 11.',
107   \ 'Global symbol "$asdf" requires explicit package name (did you forget to declare "my $asdf"?) at - line 12, <DATA> line 1.',
108   \ 'Execution of t.pl aborted due to compilation errors.',
109   \ ])