|
| 1 | +" Author: rymdbar <https://rymdbar.x20.se/> |
| 2 | + |
| 3 | +Before: |
| 4 | + call ale#assert#SetUpLinterTest('perl', 'perlnavigator') |
| 5 | + |
| 6 | +After: |
| 7 | + call ale#assert#TearDownLinterTest() |
| 8 | + |
| 9 | +Execute(The default Perl command callback should be correct): |
| 10 | + AssertLinter 'perlnavigator', |
| 11 | + \ ale#Escape('perlnavigator') . ' --stdio' |
| 12 | + |
| 13 | +Execute(Overriding the executable should work): |
| 14 | + let b:ale_perl_perlnavigator_executable = 'plnav' |
| 15 | + |
| 16 | + AssertLinter 'plnav', ale#Escape('plnav') . ' --stdio' |
| 17 | + unlet b:ale_perl_perlnavigator_executable |
| 18 | + |
| 19 | +Execute(The project root should be detected correctly in from build files): |
| 20 | + for mod in ['extutils-makemaker', 'module-build', 'dist-zilla'] |
| 21 | + call ale#test#SetFilename('../test-files/perl/' . mod . '/subdir/empty.pl') |
| 22 | + |
| 23 | + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl/' . mod) |
| 24 | + endfor |
| 25 | + |
| 26 | +Execute(The project root should be globally configurable): |
| 27 | + for mod in ['extutils-makemaker', 'module-build', 'dist-zilla'] |
| 28 | + call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl') |
| 29 | + " Configuring g:ale_root using a Dictionary works. |
| 30 | + let g:ale_root.perlnavigator = |
| 31 | + \ ale#path#Simplify(g:dir . '/../test-files/perl') |
| 32 | + |
| 33 | + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl') |
| 34 | + unlet g:ale_root.perlnavigator |
| 35 | + " As tracked by <https://github.com/dense-analysis/ale/issues/5002>, there |
| 36 | + " is a bug with g:ale_root which is thus missing here. |
| 37 | + endfor |
| 38 | + |
| 39 | +Execute(The project root should be per buffer configurable): |
| 40 | + for mod in ['extutils-makemaker', 'module-build', 'dist-zilla'] |
| 41 | + call ale#test#SetFilename('../test-files/perl/'. mod . '/subdir/empty.pl') |
| 42 | + " Configuring b:ale_root using a String works. |
| 43 | + let b:ale_root = ale#path#Simplify(g:dir . '/../test-files/perl') |
| 44 | + |
| 45 | + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl') |
| 46 | + unlet b:ale_root |
| 47 | + |
| 48 | + " Configuring b:ale_root using a Dictionary works. |
| 49 | + let b:ale_root = { |
| 50 | + \ 'perlnavigator': ale#path#Simplify(g:dir . '/../test-files/perl') |
| 51 | + \ } |
| 52 | + |
| 53 | + AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/perl') |
| 54 | + unlet b:ale_root.perlnavigator |
| 55 | + endfor |
| 56 | + |
| 57 | +Execute(The LSP values should be set correctly): |
| 58 | + |
| 59 | + AssertLSPLanguage 'perl' |
| 60 | + |
| 61 | + AssertLSPOptions {} |
| 62 | + |
| 63 | + AssertLSPConfig {} |
| 64 | + |
| 65 | +Execute(Should accept configuration settings): |
| 66 | + let b:ale_perl_perlnavigator_config = { |
| 67 | + \ 'perlnavigator': { |
| 68 | + \ 'perlcriticEnabled': 1, |
| 69 | + \ 'perlcriticProfile': '$workspaceFolder/.perlcriticrc', |
| 70 | + \ }, |
| 71 | + \ } |
| 72 | + |
| 73 | + AssertLSPConfig { |
| 74 | + \ 'perlnavigator': { |
| 75 | + \ 'perlcriticEnabled': 1, |
| 76 | + \ 'perlcriticProfile': '$workspaceFolder/.perlcriticrc', |
| 77 | + \ }, |
| 78 | + \ } |
0 commit comments