#4454 Clean up more tests and code

* Remove some tests we no longer need
* Delete blocks of redundant code
* Compress some tests together to simplify them
* Remove a little code for ancient linter versions
* Escape more executables we didn't escape before
* Rename a deno option that didn't match our conventions
This commit is contained in:
w0rp
2023-09-16 22:22:01 +01:00
parent 4b11cf21dc
commit ae1d051504
98 changed files with 257 additions and 674 deletions

View File

@@ -6,16 +6,6 @@
call ale#Set('go_go_executable', 'go') call ale#Set('go_go_executable', 'go')
call ale#Set('go_gobuild_options', '') call ale#Set('go_gobuild_options', '')
function! ale_linters#go#gobuild#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
" Run go test in local directory with relative path
return ale#go#EnvString(a:buffer)
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -c -o /dev/null ./'
endfunction
function! ale_linters#go#gobuild#GetMatches(lines) abort function! ale_linters#go#gobuild#GetMatches(lines) abort
" Matches patterns like the following: " Matches patterns like the following:
" "
@@ -50,7 +40,12 @@ call ale#linter#Define('go', {
\ 'aliases': ['go build'], \ 'aliases': ['go build'],
\ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'executable': {b -> ale#Var(b, 'go_go_executable')},
\ 'cwd': '%s:h', \ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#gobuild#GetCommand'), \ 'command': {b ->
\ ale#go#EnvString(b)
\ . ale#Escape(ale#Var(b, 'go_go_executable')) . ' test'
\ . ale#Pad(ale#Var(b, 'go_gobuild_options'))
\ . ' -c -o /dev/null ./'
\ },
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#go#gobuild#Handler', \ 'callback': 'ale_linters#go#gobuild#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -1,28 +1,21 @@
" Author: neersighted <bjorn@neersighted.com> " Author: neersighted <bjorn@neersighted.com>, John Eikenberry <jae@zhar.net>
" Description: go vet for Go files " Description: go vet for Go files
"
" Author: John Eikenberry <jae@zhar.net>
" Description: updated to work with go1.10
call ale#Set('go_go_executable', 'go') call ale#Set('go_go_executable', 'go')
call ale#Set('go_govet_options', '') call ale#Set('go_govet_options', '')
function! ale_linters#go#govet#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_govet_options')
return ale#go#EnvString(a:buffer)
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' .'
endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'govet', \ 'name': 'govet',
\ 'aliases': ['go vet'], \ 'aliases': ['go vet'],
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'executable': {b -> ale#Var(b, 'go_go_executable')},
\ 'cwd': '%s:h', \ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#govet#GetCommand'), \ 'command': {b ->
\ ale#go#EnvString(b)
\ . '%e vet'
\ . ale#Pad(ale#Var(b, 'go_govet_options'))
\ . ' .'
\ },
\ 'callback': 'ale#handlers#go#Handler', \ 'callback': 'ale#handlers#go#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,
\}) \})

View File

@@ -16,12 +16,7 @@ function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) a
return '%e --format=json --filename %s' return '%e --format=json --filename %s'
endif endif
if ale#semver#GTE(a:version, [1, 6, 0])
" Reading from stdin was introduced in ember-template-lint@1.6.0
return '%e --json --filename %s' return '%e --json --filename %s'
endif
return '%e --json %t'
endfunction endfunction
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort

View File

@@ -4,17 +4,6 @@
call ale#Set('v_v_executable', 'v') call ale#Set('v_v_executable', 'v')
call ale#Set('v_v_options', '') call ale#Set('v_v_options', '')
function! ale_linters#v#v#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'v_v_options')
" Run v in local directory with relative path
let l:command = ale#Var(a:buffer, 'v_v_executable')
\ . ale#Pad(l:options)
\ . ' .' . ' -o /tmp/vim-ale-v'
return l:command
endfunction
function! ale_linters#v#v#Handler(buffer, lines) abort function! ale_linters#v#v#Handler(buffer, lines) abort
let l:dir = expand('#' . a:buffer . ':p:h') let l:dir = expand('#' . a:buffer . ':p:h')
let l:output = [] let l:output = []
@@ -73,9 +62,11 @@ endfunction
call ale#linter#Define('v', { call ale#linter#Define('v', {
\ 'name': 'v', \ 'name': 'v',
\ 'aliases': [],
\ 'executable': {b -> ale#Var(b, 'v_v_executable')}, \ 'executable': {b -> ale#Var(b, 'v_v_executable')},
\ 'command': function('ale_linters#v#v#GetCommand'), \ 'command': {b ->
\ '%e' . ale#Pad(ale#Var(b, 'v_v_options'))
\ . ' . -o /tmp/vim-ale-v'
\ },
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#v#v#Handler', \ 'callback': 'ale_linters#v#v#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -4,7 +4,7 @@
call ale#Set('deno_executable', 'deno') call ale#Set('deno_executable', 'deno')
call ale#Set('deno_unstable', 0) call ale#Set('deno_unstable', 0)
call ale#Set('deno_importMap', 'import_map.json') call ale#Set('deno_import_map', 'import_map.json')
call ale#Set('deno_lsp_project_root', '') call ale#Set('deno_lsp_project_root', '')
function! ale#handlers#deno#GetExecutable(buffer) abort function! ale#handlers#deno#GetExecutable(buffer) abort
@@ -68,8 +68,19 @@ function! ale#handlers#deno#GetInitializationOptions(buffer) abort
let l:options.unstable = v:true let l:options.unstable = v:true
endif endif
if ale#Var(a:buffer, 'deno_importMap') isnot# '' " Look for a value set using the historical option name.
let l:options.importMap = ale#path#FindNearestFile(a:buffer, ale#Var(a:buffer, 'deno_importMap')) let l:import_map = getbufvar(
\ a:buffer,
\ 'ale_deno_importMap',
\ get(g:, 'ale_deno_importMap', '')
\)
if empty(l:import_map)
let l:import_map = ale#Var(a:buffer, 'deno_import_map')
endif
if !empty(l:import_map)
let l:options.importMap = ale#path#FindNearestFile(a:buffer, l:import_map)
endif endif
return l:options return l:options

View File

@@ -42,8 +42,8 @@ g:ale_deno_unstable *g:ale_deno_unstable*
Enable or disable unstable Deno features and APIs. Enable or disable unstable Deno features and APIs.
g:ale_deno_importMap *g:ale_deno_importMap* g:ale_deno_import_map *g:ale_deno_import_map*
*b:ale_deno_importMap* *b:ale_deno_import_map*
Type: |String| Type: |String|
Default: `'import_map.json'` Default: `'import_map.json'`

View File

@@ -1,11 +1,14 @@
Before: Before:
Save b:ale_warn_about_trailing_whitespace
runtime ale_linters/ansible/ansible_lint.vim runtime ale_linters/ansible/ansible_lint.vim
call ale#test#SetFilename('test_playbook.yml') call ale#test#SetFilename('test_playbook.yml')
let b:ale_warn_about_trailing_whitespace = 1 let b:ale_warn_about_trailing_whitespace = 1
After: After:
unlet! b:ale_warn_about_trailing_whitespace Restore
call ale#linter#Reset() call ale#linter#Reset()
Execute(The ansible-lint handler for version group <5 should handle basic errors): Execute(The ansible-lint handler for version group <5 should handle basic errors):

View File

@@ -5,7 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly): Execute(The asm GCC handler should parse lines from GCC 6.3.1 correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -5,7 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The bibclean handler should parse lines from bibclean <= v2.11.4 correctly): Execute(The bibclean handler should parse lines from bibclean <= v2.11.4 correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {
@@ -46,7 +45,6 @@ Execute(The bibclean handler should parse lines from bibclean <= v2.11.4 correct
\ ]) \ ])
Execute(The bibclean handler should parse lines of bibclean > v2.11.4 correctly): Execute(The bibclean handler should parse lines of bibclean > v2.11.4 correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -2,8 +2,6 @@ Before:
runtime ale_linters/bicep/az_bicep.vim runtime ale_linters/bicep/az_bicep.vim
After: After:
Restore
call ale#linter#Reset() call ale#linter#Reset()
Execute(The az_bicep handler should handle basic warnings): Execute(The az_bicep handler should handle basic warnings):

View File

@@ -2,8 +2,6 @@ Before:
runtime ale_linters/bicep/bicep.vim runtime ale_linters/bicep/bicep.vim
After: After:
Restore
call ale#linter#Reset() call ale#linter#Reset()
Execute(The bicep handler should handle basic warnings): Execute(The bicep handler should handle basic warnings):

View File

@@ -74,7 +74,7 @@ Execute(The brakeman handler should parse JSON correctly when there is no output
\ [], \ [],
\ ale_linters#ruby#brakeman#Handle(347, [ \ ale_linters#ruby#brakeman#Handle(347, [
\ ]) \ ])
\
Execute(The brakeman handler should handle garbage output): Execute(The brakeman handler should handle garbage output):
AssertEqual AssertEqual
\ [], \ [],

View File

@@ -5,8 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(Parsing checkmake errors should work): Execute(Parsing checkmake errors should work):
silent file Makefile
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -2,8 +2,6 @@ Before:
runtime ale_linters/cmake/cmake_lint.vim runtime ale_linters/cmake/cmake_lint.vim
After: After:
Restore
call ale#linter#Reset() call ale#linter#Reset()
Execute(The cmake_lint handler should handle basic warnings): Execute(The cmake_lint handler should handle basic warnings):

View File

@@ -19,4 +19,3 @@ Execute(Basic warnings should be handled):
\ ale_linters#chef#cookstyle#Handle(bufnr(''), [ \ ale_linters#chef#cookstyle#Handle(bufnr(''), [
\ '{"metadata":{"rubocop_version":"0.62.0","ruby_engine":"ruby","ruby_version":"2.6.0","ruby_patchlevel":"0","ruby_platform":"x86_64-linux"},"files":[{"path":"recipes/default.rb","offenses":[{"severity":"convention","message":"Style/UnneededInterpolation: Prefer `to_s` over string interpolation.","cop_name":"Style/UnneededInterpolation","corrected":false,"location":{"start_line":58,"start_column":24,"last_line":58,"last_column":40,"length":17,"line":58,"column":24}}]}],"summary":{"offense_count":1,"target_file_count":1,"inspected_file_count":1}}' \ '{"metadata":{"rubocop_version":"0.62.0","ruby_engine":"ruby","ruby_version":"2.6.0","ruby_patchlevel":"0","ruby_platform":"x86_64-linux"},"files":[{"path":"recipes/default.rb","offenses":[{"severity":"convention","message":"Style/UnneededInterpolation: Prefer `to_s` over string interpolation.","cop_name":"Style/UnneededInterpolation","corrected":false,"location":{"start_line":58,"start_column":24,"last_line":58,"last_column":40,"length":17,"line":58,"column":24}}]}],"summary":{"offense_count":1,"target_file_count":1,"inspected_file_count":1}}'
\ ]) \ ])

View File

@@ -5,7 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(cpplint warnings from included files should be parsed correctly): Execute(cpplint warnings from included files should be parsed correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -9,7 +9,7 @@ Before:
runtime ale_linters/cs/csc.vim runtime ale_linters/cs/csc.vim
After: After:
unlet! g:ale_cs_csc_source Restore
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
call ale#linter#Reset() call ale#linter#Reset()

View File

@@ -1,8 +1,4 @@
Execute(The deadnix handler should handle deadnix output): Execute(The deadnix handler should handle deadnix output):
let output = [
\'{"file":"./flake.nix","results":[{"column":5,"endColumn":9,"line":23,"message":"Unused lambda pattern: self"},{"column":2,"endColumn":6,"line":1,"message":"Unused lambda pattern: pkgs"}]}'
\]
AssertEqual AssertEqual
\ [ \ [
\ { \ {
@@ -20,7 +16,9 @@ Execute(The deadnix handler should handle deadnix output):
\ 'type': 'W', \ 'type': 'W',
\ }, \ },
\ ], \ ],
\ ale#handlers#deadnix#Handle(bufnr(''), output) \ ale#handlers#deadnix#Handle(bufnr(''), [
\ '{"file":"./flake.nix","results":[{"column":5,"endColumn":9,"line":23,"message":"Unused lambda pattern: self"},{"column":2,"endColumn":6,"line":1,"message":"Unused lambda pattern: pkgs"}]}'
\ ])
AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['']) AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), [''])
AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['not json']) AssertEqual [], ale#handlers#deadnix#Handle(bufnr(''), ['not json'])

View File

@@ -5,7 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The dogma handler should parse lines correctly): Execute(The dogma handler should parse lines correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -2,7 +2,6 @@ Before:
runtime ale_linters/eruby/erblint.vim runtime ale_linters/eruby/erblint.vim
After: After:
unlet! g:lines
call ale#linter#Reset() call ale#linter#Reset()
Execute(The erblint handler should parse lines correctly): Execute(The erblint handler should parse lines correctly):
@@ -61,10 +60,5 @@ Execute(The erblint handler should handle when files are checked and no offenses
\ ]) \ ])
Execute(The erblint handler should handle output without any errors): Execute(The erblint handler should handle output without any errors):
AssertEqual AssertEqual [], ale_linters#eruby#erblint#Handle(347, ['{}'])
\ [], AssertEqual [], ale_linters#eruby#erblint#Handle(347, [])
\ ale_linters#eruby#erblint#Handle(347, ['{}'])
AssertEqual
\ [],
\ ale_linters#eruby#erblint#Handle(347, [])

View File

@@ -16,12 +16,6 @@ Execute(The dialyzer handler should handle error messages.):
\], \],
\ ale_linters#erlang#dialyzer#Handle(bufnr(''), ['erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available']) \ ale_linters#erlang#dialyzer#Handle(bufnr(''), ['erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available'])
Execute(The dialyzer handler should handle empty file.): Execute(The dialyzer handler should handle empty input):
AssertEqual AssertEqual [], ale_linters#erlang#dialyzer#Handle(bufnr(''), [])
\[], AssertEqual [], ale_linters#erlang#dialyzer#Handle(bufnr(''), [''])
\ ale_linters#erlang#dialyzer#Handle(bufnr(''), [])
Execute(The dialyzer handler should handle empty lines.):
AssertEqual
\[],
\ ale_linters#erlang#dialyzer#Handle(bufnr(''), [''])

View File

@@ -1,23 +1,10 @@
Before: Before:
Save g:ale_c_flawfinder_error_severity Save b:ale_c_flawfinder_error_severity
unlet! g:ale_c_flawfinder_error_severity
unlet! b:ale_c_flawfinder_error_severity
runtime ale_linters/c/flawfinder.vim runtime ale_linters/c/flawfinder.vim
After: After:
unlet! g:ale_c_flawfinder_error_severity
Restore Restore
call ale#linter#Reset()
Execute(The Flawfinder handler should ignore other lines of output):
AssertEqual
\ [],
\ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [
\ 'foo',
\ 'bar',
\ 'baz',
\ ])
Execute(The Flawfinder handler should work): Execute(The Flawfinder handler should work):
AssertEqual AssertEqual
@@ -30,7 +17,10 @@ Execute(The Flawfinder handler should work):
\ }, \ },
\ ], \ ],
\ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [ \ ale#handlers#flawfinder#HandleFlawfinderFormat(347, [
\ "<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly", \ '<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly',
\ 'foo',
\ 'bar',
\ 'baz',
\ ]) \ ])
Execute(The Flawfinder error severity level should be configurable): Execute(The Flawfinder error severity level should be configurable):
@@ -52,6 +42,6 @@ Execute(The Flawfinder error severity level should be configurable):
\ }, \ },
\ ], \ ],
\ ale#handlers#flawfinder#HandleFlawfinderFormat(bufnr(''), [ \ ale#handlers#flawfinder#HandleFlawfinderFormat(bufnr(''), [
\ "<stdin>:12:4: [2] (buffer) char:Statically-sized arrays can be bad", \ '<stdin>:12:4: [2] (buffer) char:Statically-sized arrays can be bad',
\ "<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly", \ '<stdin>:31:4: [1] (buffer) strncpy:Easily used incorrectly',
\ ]) \ ])

View File

@@ -4,69 +4,6 @@ Before:
After: After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The fortran handler should parse lines from GCC 4.1.2 correctly):
AssertEqual
\ [
\ {
\ 'bufnr': 357,
\ 'lnum': 4,
\ 'col': 0,
\ 'text': "Symbol b at (1) has no IMPLICIT type",
\ 'type': 'E',
\ },
\ {
\ 'bufnr': 357,
\ 'lnum': 3,
\ 'col': 0,
\ 'text': "Symbol a at (1) has no IMPLICIT type",
\ 'type': 'E',
\ },
\ ],
\ ale_linters#fortran#gcc#Handle(357, [
\ " In file :4",
\ "",
\ "write(*,*) b",
\ " 1",
\ "Error: Symbol b at (1) has no IMPLICIT type",
\ " In file :3",
\ "",
\ "write(*,*) a",
\ " 1",
\ "Error: Symbol a at (1) has no IMPLICIT type",
\ ])
Execute(The fortran handler should parse lines from GCC 4.9.3 correctly):
AssertEqual
\ [
\ {
\ 'bufnr': 357,
\ 'lnum': 3,
\ 'col': 12,
\ 'text': "Symbol a at (1) has no IMPLICIT type",
\ 'type': 'E',
\ },
\ {
\ 'bufnr': 357,
\ 'lnum': 4,
\ 'col': 12,
\ 'text': "Symbol b at (1) has no IMPLICIT type",
\ 'type': 'E',
\ },
\ ],
\ ale_linters#fortran#gcc#Handle(357, [
\ ":3.12:",
\ "",
\ "write(*,*) a",
\ " 1",
\ "Error: Symbol a at (1) has no IMPLICIT type",
\ ":4.12:",
\ "",
\ "write(*,*) b",
\ " 1",
\ "Error: Symbol b at (1) has no IMPLICIT type",
\ ])
Execute(The fortran handler should parse lines from GCC 6.3.1 correctly): Execute(The fortran handler should parse lines from GCC 6.3.1 correctly):
AssertEqual AssertEqual
\ [ \ [

View File

@@ -5,7 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(gawk syntax errors should be parsed correctly): Execute(gawk syntax errors should be parsed correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -1,11 +1,7 @@
Execute(The GCC handler should ignore other lines of output): Execute(The GCC handler should ignore other lines of output):
AssertEqual AssertEqual
\ [], \ [],
\ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, ['foo', 'bar', 'baz'])
\ 'foo',
\ 'bar',
\ 'baz',
\ ])
Execute(GCC errors from included files should be parsed correctly): Execute(GCC errors from included files should be parsed correctly):
AssertEqual AssertEqual

View File

@@ -1,3 +1,6 @@
After:
unlet! g:detail
Execute(The ghc handler should handle hdevtools output): Execute(The ghc handler should handle hdevtools output):
call ale#test#SetFilename('foo.hs') call ale#test#SetFilename('foo.hs')

View File

@@ -2,7 +2,6 @@ Before:
runtime! ale_linters/yaml/gitlablint.vim runtime! ale_linters/yaml/gitlablint.vim
After: After:
Restore
call ale#linter#Reset() call ale#linter#Reset()
Execute(Problems should be parsed correctly for gitlablint): Execute(Problems should be parsed correctly for gitlablint):

View File

@@ -43,8 +43,6 @@ Execute (The golangci-lint handler should handle paths correctly):
Execute (The golangci-lint handler should handle only typecheck lines as errors): Execute (The golangci-lint handler should handle only typecheck lines as errors):
call ale#test#SetFilename('app/main.go') call ale#test#SetFilename('app/main.go')
let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go')
AssertEqual AssertEqual
\ [ \ [
\ { \ {
@@ -63,6 +61,6 @@ Execute (The golangci-lint handler should handle only typecheck lines as errors)
\ } \ }
\ ], \ ],
\ ale_linters#go#golangci_lint#Handler(bufnr(''), [ \ ale_linters#go#golangci_lint#Handler(bufnr(''), [
\ file . ':30:5: variable ''err'' is not used (typecheck)', \ ale#path#GetAbsPath(expand('%:p:h'), 'test.go') . ':30:5: variable ''err'' is not used (typecheck)',
\ file . ':505:75: Magic number: 404, in <argument> detected (gomnd)', \ ale#path#GetAbsPath(expand('%:p:h'), 'test.go') . ':505:75: Magic number: 404, in <argument> detected (gomnd)',
\ ]) \ ])

View File

@@ -5,7 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The asm llvm-mc handler should parse lines correctly): Execute(The asm llvm-mc handler should parse lines correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -33,4 +33,3 @@ Execute(The luac handler should parse lines correctly):
\ 'luac /file/path/here.lua:3: unexpected symbol near ''-''', \ 'luac /file/path/here.lua:3: unexpected symbol near ''-''',
\ 'luac /file/path/here.lua:5: ''='' expected near '')''', \ 'luac /file/path/here.lua:5: ''='' expected near '')''',
\ ]) \ ])

View File

@@ -4,64 +4,7 @@ Before:
After: After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The Markdownlint handler should parse pre v0.19.0 output with single digit line correctly): Execute(The Markdownlint handler should parse output with a column correctly):
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'code': 'MD013/line-length',
\ 'text': 'Line length [Expected: 80; Actual: 114]',
\ 'type': 'W'
\ }
\ ],
\ ale#handlers#markdownlint#Handle(0, [
\ 'README.md: 1: MD013/line-length Line length [Expected: 80; Actual: 114]'
\ ])
Execute(The Markdownlint handler should parse pre v0.19.0 output with multi digit line correctly):
AssertEqual
\ [
\ {
\ 'lnum': 100,
\ 'code': 'MD013/line-length',
\ 'text': 'Line length [Expected: 80; Actual: 114]',
\ 'type': 'W'
\ }
\ ],
\ ale#handlers#markdownlint#Handle(0, [
\ 'README.md: 100: MD013/line-length Line length [Expected: 80; Actual: 114]'
\ ])
Execute(The Markdownlint handler should parse post v0.19.0 output with single digit line correctly):
AssertEqual
\ [
\ {
\ 'lnum': 1,
\ 'code': 'MD013/line-length',
\ 'text': 'Line length [Expected: 80; Actual: 114]',
\ 'type': 'W'
\ }
\ ],
\ ale#handlers#markdownlint#Handle(0, [
\ 'README.md:1 MD013/line-length Line length [Expected: 80; Actual: 114]'
\ ])
Execute(The Markdownlint handler should parse post v0.19.0 output with multi digit line correctly):
AssertEqual
\ [
\ {
\ 'lnum': 100,
\ 'code': 'MD013/line-length',
\ 'text': 'Line length [Expected: 80; Actual: 114]',
\ 'type': 'W'
\ }
\ ],
\ ale#handlers#markdownlint#Handle(0, [
\ 'README.md:100 MD013/line-length Line length [Expected: 80; Actual: 114]'
\ ])
Execute(The Markdownlint handler should parse post v0.22.0 output with column correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -5,7 +5,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The mix handler should parse lines correctly): Execute(The mix handler should parse lines correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -17,4 +17,3 @@ Execute(The Perl::Critic handler should create all issues as warnings):
\ ale_linters#perl#perlcritic#Handle(99, [ \ ale_linters#perl#perlcritic#Handle(99, [
\ '21:17 Regular expression without "/m" flag' \ '21:17 Regular expression without "/m" flag'
\ ]) \ ])

View File

@@ -4,8 +4,6 @@ Before:
runtime ale_linters/php/phpstan.vim runtime ale_linters/php/phpstan.vim
After: After:
Restore
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
call ale#linter#Reset() call ale#linter#Reset()

View File

@@ -10,8 +10,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
silent file something_else.py
Execute(Basic prospector errors should be handle): Execute(Basic prospector errors should be handle):
AssertEqual AssertEqual
\ [ \ [

View File

@@ -14,7 +14,6 @@ After:
unlet! b:ale_warn_about_trailing_whitespace unlet! b:ale_warn_about_trailing_whitespace
call ale#linter#Reset() call ale#linter#Reset()
silent file something_else.py
Execute(The pycodestyle handler should parse output): Execute(The pycodestyle handler should parse output):
AssertEqual AssertEqual

View File

@@ -20,7 +20,7 @@ After:
" This is a multi-line description that should produce multiple errors to be " This is a multi-line description that should produce multiple errors to be
" tested by the handler " tested by the handler
" """ " """
" return Fales " return False
" "
" "
" if __name__ == '__main__': " if __name__ == '__main__':

View File

@@ -1,12 +1,19 @@
Before: Before:
Save g:ale_ruby_reek_show_context
Save g:ale_ruby_reek_show_wiki_link
let g:ale_ruby_reek_show_context = 0
let g:ale_ruby_reek_show_wiki_link = 0
runtime ale_linters/ruby/reek.vim runtime ale_linters/ruby/reek.vim
After: After:
Restore
call ale#linter#Reset() call ale#linter#Reset()
Execute(The reek handler should parse JSON correctly, with only context enabled): Execute(The reek handler should parse JSON correctly, with only context enabled):
let g:ale_ruby_reek_show_context = 1 let g:ale_ruby_reek_show_context = 1
let g:ale_ruby_reek_show_wiki_link = 0
AssertEqual AssertEqual
\ [ \ [
@@ -34,9 +41,6 @@ Execute(The reek handler should parse JSON correctly, with only context enabled)
\ ]) \ ])
Execute(The reek handler should parse JSON correctly, with no context or wiki links): Execute(The reek handler should parse JSON correctly, with no context or wiki links):
let g:ale_ruby_reek_show_context = 0
let g:ale_ruby_reek_show_wiki_link = 0
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -30,4 +30,3 @@ Execute(Warning and error messages should be handled correctly):
\ 'test.robot:W:1:2:RequireSuiteDocumentation:No suite documentation', \ 'test.robot:W:1:2:RequireSuiteDocumentation:No suite documentation',
\ 'test.robot:E:3:4:RequireTestDocumentation:No testcase documentation' \ 'test.robot:E:3:4:RequireTestDocumentation:No testcase documentation'
\]) \])

View File

@@ -2,7 +2,6 @@ Before:
runtime ale_linters/ruby/rubocop.vim runtime ale_linters/ruby/rubocop.vim
After: After:
unlet! g:lines
call ale#linter#Reset() call ale#linter#Reset()
Execute(The rubocop handler should parse lines correctly): Execute(The rubocop handler should parse lines correctly):
@@ -59,18 +58,6 @@ Execute(The rubocop handler should handle when no files are checked):
\ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[],"summary":{"offense_count":0,"target_file_count":0,"inspected_file_count":0}}' \ '{"metadata":{"rubocop_version":"0.47.1","ruby_engine":"ruby","ruby_version":"2.1.5","ruby_patchlevel":"273","ruby_platform":"x86_64-linux-gnu"},"files":[],"summary":{"offense_count":0,"target_file_count":0,"inspected_file_count":0}}'
\ ]) \ ])
Execute(The rubocop handler should handle output without any errors): Execute(The rubocop handler should handle empty output):
let g:lines = [ AssertEqual [], ale#ruby#HandleRubocopOutput(347, ['{}'])
\ '{"metadata":{"rubocop_version":"0.48.1","ruby_engine":"ruby","ruby_version":"2.4.1","ruby_patchlevel":"111","ruby_platform":"x86_64-darwin16"},"files":[]}', AssertEqual [], ale#ruby#HandleRubocopOutput(347, [])
\]
AssertEqual
\ [],
\ ale#ruby#HandleRubocopOutput(347, g:lines)
\
AssertEqual
\ [],
\ ale#ruby#HandleRubocopOutput(347, ['{}'])
AssertEqual
\ [],
\ ale#ruby#HandleRubocopOutput(347, [])

View File

@@ -1,3 +1,11 @@
Before:
Save g:ale_rust_ignore_secondary_spans
let g:ale_rust_ignore_secondary_spans = 0
After:
Restore
Execute(The Rust handler should handle rustc output): Execute(The Rust handler should handle rustc output):
call ale#test#SetFilename('src/playpen.rs') call ale#test#SetFilename('src/playpen.rs')
@@ -340,7 +348,6 @@ Execute(The Rust handler should find correct files):
Execute(The Rust handler should remove secondary spans if set): Execute(The Rust handler should remove secondary spans if set):
call ale#test#SetFilename('src/noerrors/mod.rs') call ale#test#SetFilename('src/noerrors/mod.rs')
let g:ale_rust_ignore_secondary_spans = 0
AssertEqual AssertEqual
\ [ \ [
\ { \ {
@@ -416,6 +423,7 @@ Execute(The Rust handler should remove secondary spans if set):
\ ]) \ ])
let g:ale_rust_ignore_secondary_spans = 1 let g:ale_rust_ignore_secondary_spans = 1
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -1,6 +1,3 @@
After:
call ale#linter#Reset()
Execute(The handler should return an empty list with empty input): Execute(The handler should return an empty list with empty input):
AssertEqual [], ale#handlers#scala#HandleScalacLintFormat(bufnr(''), []) AssertEqual [], ale#handlers#scala#HandleScalacLintFormat(bufnr(''), [])

View File

@@ -6,7 +6,6 @@ After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The slim handler should parse lines correctly): Execute(The slim handler should parse lines correctly):
AssertEqual AssertEqual
\ [ \ [
\ { \ {

View File

@@ -2,8 +2,6 @@ Before:
runtime ale_linters/sql/sqlfluff.vim runtime ale_linters/sql/sqlfluff.vim
After: After:
Restore
call ale#linter#Reset() call ale#linter#Reset()
Execute(The sqlfluff handler should handle basic warnings): Execute(The sqlfluff handler should handle basic warnings):

View File

@@ -37,5 +37,4 @@ Execute(textlint handler should handle errors output):
Execute(textlint handler should no error output): Execute(textlint handler should no error output):
AssertEqual AssertEqual
\ [], \ [],
\ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), [ \ ale#handlers#textlint#HandleTextlintOutput(bufnr(''), [])
\ ])

View File

@@ -4,32 +4,6 @@ Before:
After: After:
call ale#linter#Reset() call ale#linter#Reset()
Execute(The tflint handler should parse items correctly for pre 0.11):
AssertEqual
\ [
\ {
\ 'lnum': 12,
\ 'text': 'be warned, traveller',
\ 'code': 'aws_db_instance_readable_password',
\ 'type': 'W',
\ },
\ {
\ 'lnum': 9,
\ 'text': 'error message',
\ 'code': 'aws_elasticache_cluster_invalid_type',
\ 'type': 'E',
\ },
\ {
\ 'lnum': 5,
\ 'text': 'just so ya know',
\ 'code': 'aws_instance_not_specified_iam_profile',
\ 'type': 'I',
\ },
\ ],
\ ale_linters#terraform#tflint#Handle(123, [
\ '[ { "detector": "aws_db_instance_readable_password", "type": "WARNING", "message": "be warned, traveller", "line": 12, "file": "github.com/wata727/example-module/aws_db_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_db_instance_readable_password.md" }, { "detector": "aws_elasticache_cluster_invalid_type", "type": "ERROR", "message": "error message", "line": 9, "file": "github.com/wata727/example-module/aws_elasticache_cluster.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_elasticache_cluster_invalid_type.md" }, { "detector": "aws_instance_not_specified_iam_profile", "type": "NOTICE", "message": "just so ya know", "line": 5, "file": "github.com/wata727/example-module/aws_instance.tf", "link": "https://github.com/wata727/tflint/blob/master/docs/aws_instance_not_specified_iam_profile.md" } ]'
\ ])
Execute(The tflint handler should parse items correctly): Execute(The tflint handler should parse items correctly):
AssertEqual AssertEqual
\ [ \ [

View File

@@ -4,7 +4,6 @@ Before:
After: After:
call ale#linter#Reset() call ale#linter#Reset()
Execute (The verilator handler should parse legacy messages with only line numbers): Execute (The verilator handler should parse legacy messages with only line numbers):
AssertEqual AssertEqual
\ [ \ [
@@ -26,7 +25,6 @@ Execute (The verilator handler should parse legacy messages with only line numbe
\ '%Warning-BLKSEQ: bar.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).', \ '%Warning-BLKSEQ: bar.v:10: Blocking assignments (=) in sequential (flop or latch) block; suggest delayed assignments (<=).',
\ ]) \ ])
Execute (The verilator handler should parse new format messages with line and column numbers): Execute (The verilator handler should parse new format messages with line and column numbers):
AssertEqual AssertEqual
\ [ \ [
@@ -49,4 +47,3 @@ Execute (The verilator handler should parse new format messages with line and co
\ '%Error: bar.v:3:1: syntax error, unexpected endmodule, expecting ;', \ '%Error: bar.v:3:1: syntax error, unexpected endmodule, expecting ;',
\ '%Warning-UNUSED: foo.v:4:6: Signal is not used: r', \ '%Warning-UNUSED: foo.v:4:6: Signal is not used: r',
\ ]) \ ])

View File

@@ -9,8 +9,6 @@ After:
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
call ale#linter#Reset() call ale#linter#Reset()
silent file something_else.py
Execute(Basic vulture check with relative path in result should be handled): Execute(Basic vulture check with relative path in result should be handled):
call ale#test#SetFilename('something_else.py') call ale#test#SetFilename('something_else.py')
AssertEqual AssertEqual

View File

@@ -18,7 +18,6 @@ Before:
unlet! b:ale_textlint_options unlet! b:ale_textlint_options
After: After:
unlet! b:command_tail
unlet! b:ale_textlint_executable unlet! b:ale_textlint_executable
unlet! b:ale_textlint_use_global unlet! b:ale_textlint_use_global
unlet! b:ale_textlint_options unlet! b:ale_textlint_options
@@ -29,17 +28,12 @@ Execute(The default command should be correct):
AssertLinter 'textlint', AssertLinter 'textlint',
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
Execute(The executable should be configurable): Execute(The executable and options should be configurable):
let b:ale_textlint_executable = 'foobar' let b:ale_textlint_executable = 'foobar'
AssertLinter 'foobar',
\ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
Execute(The options should be configurable):
let b:ale_textlint_options = '--something' let b:ale_textlint_options = '--something'
AssertLinter 'textlint', AssertLinter 'foobar',
\ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' \ ale#Escape('foobar') . ' --something -f json --stdin --stdin-filename %s'
Execute(The local executable from .bin should be used if available): Execute(The local executable from .bin should be used if available):
call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt')

View File

@@ -11,9 +11,10 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The default command should be correct):
AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
Execute(The executable should be configurable):
let b:ale_asm_gcc_executable = 'foobar' let b:ale_asm_gcc_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail

View File

@@ -15,27 +15,14 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(should set correct defaults): Execute(The default bingo executable and options should be correct):
AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio' AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio'
Execute(should configure bingo callback executable): Execute(The bingo executable and options should be configurable):
let b:ale_go_bingo_executable = 'boo' let b:ale_go_bingo_executable = 'boo'
let b:ale_go_bingo_options = ''
AssertLinter 'boo', ale#Escape('boo')
Execute(should set bingo options):
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
" let b:ale_completion_enabled = 1
let b:ale_go_bingo_options = ''
AssertLinter 'bingo',
\ ale#Escape('bingo') . ''
let b:ale_go_bingo_options = '--mode stdio --trace' let b:ale_go_bingo_options = '--mode stdio --trace'
AssertLinter 'bingo', AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio --trace'
\ ale#Escape('bingo') . ' --mode stdio --trace'
Execute(should support Go environment variables): Execute(should support Go environment variables):
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go') call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
@@ -44,7 +31,6 @@ Execute(should support Go environment variables):
AssertLinter 'bingo', AssertLinter 'bingo',
\ ale#Env('GO111MODULE', 'on') . ale#Escape('bingo') . ' --mode stdio' \ ale#Env('GO111MODULE', 'on') . ale#Escape('bingo') . ' --mode stdio'
Execute(Should return directory for 'go.mod' if found in parent directory): Execute(Should return directory for 'go.mod' if found in parent directory):
call ale#test#SetFilename('../test-files/go/test.go') call ale#test#SetFilename('../test-files/go/test.go')

View File

@@ -4,7 +4,6 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(Should use default command when bazel_buildifier_options are not set): Execute(Should use default command when bazel_buildifier_options are not set):
call ale#test#SetDirectory('/testplugin/test/test-files/bzl/bazel-package') call ale#test#SetDirectory('/testplugin/test/test-files/bzl/bazel-package')
call ale#test#SetFilename('BUILD.bazel') call ale#test#SetFilename('BUILD.bazel')

View File

@@ -12,12 +12,6 @@ Execute(The clangtidy command default should be correct):
AssertLinter 'clang-tidy', AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy') . ' %s' \ ale#Escape('clang-tidy') . ' %s'
Execute(You should be able to remove the -checks option for clang-tidy):
let b:ale_c_clangtidy_checks = []
AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy') . ' %s'
Execute(You should be able to set other checks for clang-tidy): Execute(You should be able to set other checks for clang-tidy):
let b:ale_c_clangtidy_checks = ['-*', 'clang-analyzer-*'] let b:ale_c_clangtidy_checks = ['-*', 'clang-analyzer-*']

View File

@@ -4,7 +4,7 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The flawfinder command should be correct): Execute(The default flawfinder command should be correct):
AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t' AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t'
Execute(The minlevel of flawfinder should be configurable): Execute(The minlevel of flawfinder should be configurable):
@@ -13,12 +13,7 @@ Execute(The minlevel of flawfinder should be configurable):
AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t' AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t'
Execute(Additional flawfinder options should be configurable): Execute(Additional flawfinder options should be configurable):
let b:ale_c_flawfinder_executable = 'foo'
let b:ale_c_flawfinder_options = '--foobar' let b:ale_c_flawfinder_options = '--foobar'
AssertLinter 'flawfinder', AssertLinter 'foo', ale#Escape('foo') . ' -CDQS --foobar --minlevel=1 %t'
\ ale#Escape('flawfinder') . ' -CDQS --foobar --minlevel=1 %t'
Execute(The flawfinder executable should be configurable):
let b:ale_c_flawfinder_executable = 'foo/bar'
AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t'

View File

@@ -12,12 +12,6 @@ Execute(The clangtidy command default should be correct):
AssertLinter 'clang-tidy', AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy') . ' %s' \ ale#Escape('clang-tidy') . ' %s'
Execute(You should be able to remove the -checks option for clang-tidy):
let b:ale_cpp_clangtidy_checks = []
AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy') . ' %s'
Execute(You should be able to set other checks for clang-tidy): Execute(You should be able to set other checks for clang-tidy):
let b:ale_cpp_clangtidy_checks = ['-*', 'clang-analyzer-*'] let b:ale_cpp_clangtidy_checks = ['-*', 'clang-analyzer-*']

View File

@@ -4,16 +4,11 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default cookstyle command should be correct):
AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --force-exclusion --format json --stdin %s' AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --force-exclusion --format json --stdin %s'
Execute(The executable path should be configurable): Execute(The cookstyle executable and options should be configurable):
let b:ale_chef_cookstyle_executable = 'foobar' let b:ale_chef_cookstyle_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' --force-exclusion --format json --stdin %s'
Execute(The linter options should be configurable):
let b:ale_chef_cookstyle_options = '--parallel' let b:ale_chef_cookstyle_options = '--parallel'
AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --parallel --force-exclusion --format json --stdin %s' AssertLinter 'foobar', ale#Escape('foobar') . ' --parallel --force-exclusion --format json --stdin %s'

View File

@@ -68,4 +68,3 @@ Execute(Additional cspell options should be configurable):
\ 'cspell', \ 'cspell',
\ ale#Escape('cspell') \ ale#Escape('cspell')
\ . ' lint --no-color --no-progress --no-summary --foobar -- stdin' \ . ' lint --no-color --no-progress --no-summary --foobar -- stdin'

View File

@@ -4,12 +4,12 @@ Before:
let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls' let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls'
let b:cfg = ale#path#Simplify(g:dir . '/../config_linux')
if has('win32') if has('win32')
let b:cfg = ale#path#Simplify(g:dir . '/../config_win') let b:cfg = ale#path#Simplify(g:dir . '/../config_win')
elseif has('macunix') elseif has('macunix')
let b:cfg = ale#path#Simplify(g:dir . '/../config_mac') let b:cfg = ale#path#Simplify(g:dir . '/../config_mac')
else
let b:cfg = ale#path#Simplify(g:dir . '/../config_linux')
endif endif
After: After:

View File

@@ -10,14 +10,8 @@ Execute(Runs the right command for ember-template-lint >= 4.x):
AssertLinter 'ember-template-lint', AssertLinter 'ember-template-lint',
\ ale#Escape('ember-template-lint') . ' --format=json --filename %s' \ ale#Escape('ember-template-lint') . ' --format=json --filename %s'
Execute(Runs the right command for ember-template-lint >= 1.6, < 4.x): Execute(Runs the right command for ember-template-lint < 4.x):
GivenCommandOutput ['1.6.0'] GivenCommandOutput ['3.14.0']
AssertLinter 'ember-template-lint', AssertLinter 'ember-template-lint',
\ ale#Escape('ember-template-lint') . ' --json --filename %s' \ ale#Escape('ember-template-lint') . ' --json --filename %s'
Execute(Runs the right command for ember-template-lint < 1.6):
GivenCommandOutput ['1.5.0']
AssertLinter 'ember-template-lint',
\ ale#Escape('ember-template-lint') . ' --json %t'

View File

@@ -4,15 +4,12 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default foodcritic command should be correct):
AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' %s' AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' %s'
Execute(Extra options should be included with escapeed tildes (~)): Execute(The foodcritic executable and options should be configurable):
let b:ale_chef_foodcritic_executable = 'foobar'
" Tides should be escaped
let b:ale_chef_foodcritic_options = '-t ~F011' let b:ale_chef_foodcritic_options = '-t ~F011'
AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' -t \~F011 %s' AssertLinter 'foobar', ale#Escape('foobar') . ' -t \~F011 %s'
Execute(The executable should be configurable):
let b:ale_chef_foodcritic_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'

View File

@@ -4,21 +4,17 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The fortran gcc command callback should return the correct default string): Execute(The default fortran gcc command should be correct):
AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -' AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -'
Execute(The fortran gcc command callback should let you set options): Execute(The fortran gcc executable and command should be configurable):
let g:ale_fortran_gcc_executable = 'gfortran'
let g:ale_fortran_gcc_options = '-Wotherthings' let g:ale_fortran_gcc_options = '-Wotherthings'
AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wotherthings -' AssertLinter 'gfortran', ale#Escape('gfortran')
\ . ' -S -x f95 -fsyntax-only -ffree-form -Wotherthings -'
Execute(The fortran gcc command callback should let you use -ffixed-form): Execute(The fortran gcc linter should allow you to use -ffixed-form):
let g:ale_fortran_gcc_use_free_form = 0 let g:ale_fortran_gcc_use_free_form = 0
AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffixed-form -Wall -' AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffixed-form -Wall -'
Execute(The fortran executable should be configurable):
let g:ale_fortran_gcc_executable = 'gfortran'
AssertLinter 'gfortran',
\ ale#Escape('gfortran') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -'

View File

@@ -3,31 +3,24 @@ Before:
call ale#assert#SetUpLinterTest('go', 'gobuild') call ale#assert#SetUpLinterTest('go', 'gobuild')
GivenCommandOutput ['/foo/bar', '/foo/baz']
After: After:
Restore
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default go test command should be correct):
AssertLinterCwd '%s:h' AssertLinterCwd '%s:h'
AssertLinter 'go', 'go test -c -o /dev/null ./' AssertLinter 'go', ale#Escape('go') . ' test -c -o /dev/null ./'
Execute(Go environment variables should be supported): Execute(Go environment variables should be supported):
let b:ale_go_go111module = 'on' let b:ale_go_go111module = 'on'
AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go test -c -o /dev/null ./' AssertLinter 'go', ale#Env('GO111MODULE', 'on')
\ . ale#Escape('go') . ' test -c -o /dev/null ./'
unlet! b:ale_go_go111module unlet! b:ale_go_go111module
Execute(Extra options should be supported): Execute(The go test executable and options should be configurable):
let g:ale_go_go_executable = 'foobar'
let g:ale_go_gobuild_options = '--foo-bar' let g:ale_go_gobuild_options = '--foo-bar'
AssertLinter 'go', 'go test --foo-bar -c -o /dev/null ./' AssertLinter 'foobar', ale#Escape('foobar')
\ . ' test --foo-bar -c -o /dev/null ./'
let g:ale_go_gobuild_options = ''
Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
AssertLinter 'foobar', 'foobar test -c -o /dev/null ./'

View File

@@ -12,21 +12,17 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default go vet command should be correct):
AssertLinter 'go', 'go vet .' AssertLinter 'go', ale#Escape('go') . ' vet .'
AssertLinterCwd '%s:h'
Execute(Extra options should be supported): Execute(The go vet command and options should be configurable):
let g:ale_go_go_executable = 'foobar'
let g:ale_go_govet_options = '--foo-bar' let g:ale_go_govet_options = '--foo-bar'
AssertLinterCwd '%s:h' AssertLinter 'foobar', ale#Escape('foobar') . ' vet --foo-bar .'
AssertLinter 'go', 'go vet --foo-bar .'
Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
AssertLinter 'foobar', 'foobar vet .'
Execute(Go environment variables should be supported): Execute(Go environment variables should be supported):
let b:ale_go_go111module = 'on' let b:ale_go_go111module = 'on'
AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go vet .' AssertLinter 'go', ale#Env('GO111MODULE', 'on') . ale#Escape('go') . ' vet .'

View File

@@ -4,9 +4,10 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The options should be used in the command): Execute(The default ghc command should be correct):
AssertLinter 'ghc', 'ghc -fno-code -v0 %t' AssertLinter 'ghc', 'ghc -fno-code -v0 %t'
Execute(The ghc options should be configurable):
let b:ale_haskell_ghc_options = 'foobar' let b:ale_haskell_ghc_options = 'foobar'
AssertLinter 'ghc', 'ghc foobar %t' AssertLinter 'ghc', 'ghc foobar %t'

View File

@@ -1,9 +1,6 @@
Before: Before:
call ale#assert#SetUpLinterTest('haskell', 'hie') call ale#assert#SetUpLinterTest('haskell', 'hie')
Save &filetype
let &filetype = 'haskell'
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
@@ -11,8 +8,7 @@ Execute(The language string should be correct):
AssertLSPLanguage 'haskell' AssertLSPLanguage 'haskell'
Execute(The default executable should be correct): Execute(The default executable should be correct):
AssertLinter 'hie', AssertLinter 'hie', ale#Escape('hie') . ' --lsp'
\ ale#Escape('hie') . ' --lsp'
Execute(The project root should be detected correctly): Execute(The project root should be detected correctly):
AssertLSPProject g:dir AssertLSPProject g:dir

View File

@@ -4,17 +4,11 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The default ispc command should be configurable):
AssertLinter 'ispc', AssertLinter 'ispc', ale#Escape('ispc') . ' --nowrap %s'
\ ale#Escape('ispc') . ' --nowrap %s'
Execute(The ispc executable nad options should be configurable):
let b:ale_ispc_ispc_executable = 'foo' let b:ale_ispc_ispc_executable = 'foo'
AssertLinter 'foo',
\ ale#Escape('foo') . ' --nowrap %s'
Execute(The options should be configurable):
let g:ale_ispc_ispc_options = '--foo' let g:ale_ispc_ispc_options = '--foo'
AssertLinter 'ispc', AssertLinter 'foo', ale#Escape('foo') . ' --nowrap --foo' . ' %s'
\ ale#Escape('ispc') . ' --nowrap --foo' . ' %s'

View File

@@ -1,4 +1,3 @@
Before: Before:
call ale#assert#SetUpLinterTest('java', 'javalsp') call ale#assert#SetUpLinterTest('java', 'javalsp')
@@ -39,18 +38,6 @@ Execute(The javalsp should have default config):
\ }, \ },
\ ale_linters#java#javalsp#Config(bufnr('')) \ ale_linters#java#javalsp#Config(bufnr(''))
Execute(The javalsp should have default config if user sets empty hash):
let b:ale_java_javalsp_config = {}
AssertEqual
\ {
\ 'java': {
\ 'classPath': [],
\ 'externalDependencies': []
\ }
\ },
\ ale_linters#java#javalsp#Config(bufnr(''))
Execute(The javalsp should have add missing config): Execute(The javalsp should have add missing config):
let b:ale_java_javalsp_config = { 'java': { 'classPath': ['aaa.jar'] } } let b:ale_java_javalsp_config = { 'java': { 'classPath': ['aaa.jar'] } }

View File

@@ -1,5 +1,10 @@
Before: Before:
let g:ale_deno_importMap = 'import_map.json' Save g:ale_deno_import_map
Save g:ale_deno_unstable
Save g:ale_deno_executable
Save g:ale_deno_lsp_project_root
let g:ale_deno_import_map = 'import_map.json'
let g:ale_deno_unstable = 0 let g:ale_deno_unstable = 0
let g:ale_deno_executable = 'deno' let g:ale_deno_executable = 'deno'
let g:ale_deno_lsp_project_root = '' let g:ale_deno_lsp_project_root = ''
@@ -39,7 +44,7 @@ Execute(Should set the default importMap filepath):
\} \}
Execute(Should set the importMap filepath from user defined importMap): Execute(Should set the importMap filepath from user defined importMap):
let g:ale_deno_importMap = 'custom_import_map.json' let g:ale_deno_import_map = 'custom_import_map.json'
call ale#test#SetFilename('../test-files/javascript_deno/main.js') call ale#test#SetFilename('../test-files/javascript_deno/main.js')
AssertLSPOptions { AssertLSPOptions {
@@ -50,7 +55,7 @@ Execute(Should set the importMap filepath from user defined importMap):
\} \}
Execute(Should set the importMap filepath from user defined importMap with unstable API): Execute(Should set the importMap filepath from user defined importMap with unstable API):
let g:ale_deno_importMap = 'custom_import_map.json' let g:ale_deno_import_map = 'custom_import_map.json'
let g:ale_deno_unstable = 1 let g:ale_deno_unstable = 1
call ale#test#SetFilename('../test-files/javascript_deno/main.js') call ale#test#SetFilename('../test-files/javascript_deno/main.js')

View File

@@ -1,4 +1,10 @@
Before: Before:
Save g:ale_languagetool_executable
Save g:ale_languagetool_options
let g:ale_languagetool_executable = 'languagetool'
let g:ale_languagetool_options = '--autoDetect'
call ale#assert#SetUpLinterTest('text', 'languagetool') call ale#assert#SetUpLinterTest('text', 'languagetool')
After: After:
@@ -10,13 +16,7 @@ Execute(The default command should be correct):
Execute(Should be able to set a custom executable): Execute(Should be able to set a custom executable):
let g:ale_languagetool_executable = 'foobar' let g:ale_languagetool_executable = 'foobar'
AssertLinter 'foobar' , ale#Escape('foobar')
\ . ' --autoDetect %s'
Execute(Should be able to include custom languagetool options):
let g:ale_languagetool_options = '--language en' let g:ale_languagetool_options = '--language en'
" is now 'foobar' based on above global AssertLinter 'foobar' , ale#Escape('foobar')
AssertLinter 'foobar', ale#Escape('foobar')
\ . ' --language en %s' \ . ' --language en %s'

View File

@@ -11,9 +11,10 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The default llvm-mc command should be correct):
AssertLinter 'llvm-mc', ale#Escape('llvm-mc') . b:command_tail AssertLinter 'llvm-mc', ale#Escape('llvm-mc') . b:command_tail
Execute(The llvm-mc executable should be configurable):
let b:ale_asm_llvm_mc_executable = 'foobar' let b:ale_asm_llvm_mc_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail

View File

@@ -4,15 +4,11 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default markdownlint command should be correct):
AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s' AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s'
Execute(The executable should be configurable): Execute(The executable should be configurable):
let g:ale_markdown_markdownlint_executable = 'foo bar' let g:ale_markdown_markdownlint_executable = 'foo bar'
let g:ale_markdown_markdownlint_options = '--option'
AssertLinter 'foo bar', ale#Escape('foo bar') . ' %s' AssertLinter 'foo bar', ale#Escape('foo bar') . ' --option %s'
Execute(The options should be configurable):
let g:ale_markdown_markdownlint_options = '--config ~/custom/.markdownlintrc'
AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' --config ~/custom/.markdownlintrc %s'

View File

@@ -6,14 +6,11 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The default nagelfar command should be correct):
AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' %s' AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' %s'
Execute(The negalfar executable and options should be configurable):
let b:ale_tcl_nagelfar_executable = 'foobar' let b:ale_tcl_nagelfar_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
Execute(The options should be configurable):
let b:ale_tcl_nagelfar_options = '--something' let b:ale_tcl_nagelfar_options = '--something'
AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' --something %s' AssertLinter 'foobar', ale#Escape('foobar') . ' --something %s'

View File

@@ -1,32 +1,19 @@
Before: Before:
call ale#assert#SetUpLinterTest('nasm', 'nasm') call ale#assert#SetUpLinterTest('nasm', 'nasm')
let b:command_tail =
\ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
let b:command_tail_opt =
\ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
After: After:
unlet! b:command_tail
unlet! b:command_tail_opt
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The default nasm command should be correct):
AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail,
let b:ale_nasm_nasm_executable = '~/nasm'
AssertLinter '~/nasm', ale#Escape('~/nasm') . b:command_tail
Execute(The options should be configurable):
let b:ale_nasm_nasm_options = '-w-macro-params'
AssertLinter 'nasm', ale#Escape('nasm') AssertLinter 'nasm', ale#Escape('nasm')
\ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') \ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/')
\ . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null') \ . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
Execute(The options should be used in command): Execute(The nasm executable and options should be configurable):
let b:ale_nasm_nasm_options = '-w+orphan-labels' let b:ale_nasm_nasm_executable = '~/nasm'
let b:ale_nasm_nasm_options = '-w-macro-params'
AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail_opt AssertLinter '~/nasm', ale#Escape('~/nasm')
\ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/')
\ . ' -w-macro-params'
\ . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')

View File

@@ -4,16 +4,11 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The statix command should be correct): Execute(The default statix command should be correct):
AssertLinter 'statix', ale#Escape('statix') . ' check -o errfmt --stdin' AssertLinter 'statix', ale#Escape('statix') . ' check -o errfmt --stdin'
Execute(Additional statix options should be configurable): Execute(The statix executable and options should be configurable):
let g:ale_nix_statix_check_executable = 'foo'
let g:ale_nix_statix_check_options = '--foobar' let g:ale_nix_statix_check_options = '--foobar'
AssertLinter 'statix', AssertLinter 'foo', ale#Escape('foo') . ' check -o errfmt --stdin --foobar'
\ ale#Escape('statix') . ' check -o errfmt --stdin --foobar'
Execute(The statix command should be configurable):
let g:ale_nix_statix_check_executable = 'foo/bar'
AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' check -o errfmt --stdin'

View File

@@ -5,8 +5,6 @@ Before:
call ale#test#SetFilename('test.groovy') call ale#test#SetFilename('test.groovy')
After: After:
Restore
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default npm-groovy-lint command should be correct): Execute(The default npm-groovy-lint command should be correct):

View File

@@ -4,9 +4,11 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The options should be used in the command): Execute(The default ponyc command should be correct):
AssertLinter 'ponyc', ale#Escape('ponyc') . ' --pass paint' AssertLinter 'ponyc', ale#Escape('ponyc') . ' --pass paint'
let b:ale_pony_ponyc_options = 'foobar' Execute(The pony executable and options should be configurable):
let b:ale_pony_ponyc_executable = 'foobar'
let b:ale_pony_ponyc_options = '--some-option'
AssertLinter 'ponyc', ale#Escape('ponyc') . ' foobar' AssertLinter 'foobar', ale#Escape('foobar') . ' --some-option'

View File

@@ -33,7 +33,6 @@ Execute(pycln should run with the stdin in new enough versions):
AssertLinterCwd expand('%:p:h') AssertLinterCwd expand('%:p:h')
AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . ' -' AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . ' -'
" AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail[:-3] . '--check -'
Execute(The option for disabling changing directories should work): Execute(The option for disabling changing directories should work):
let g:ale_python_pycln_change_directory = 0 let g:ale_python_pycln_change_directory = 0
@@ -41,17 +40,11 @@ Execute(The option for disabling changing directories should work):
AssertLinterCwd '' AssertLinterCwd ''
AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail AssertLinter 'pycln', ale#Escape('pycln') . b:cmd_tail
Execute(The pycln executable should be configurable, and escaped properly): Execute(The pycln executable and options should be configurable):
let g:ale_python_pycln_executable = 'executable with spaces' let g:ale_python_pycln_executable = 'foo'
AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . b:cmd_tail
Execute(The pycln command callback should let you set options):
let g:ale_python_pycln_options = '--some-flag' let g:ale_python_pycln_options = '--some-flag'
AssertLinter 'pycln', ale#Escape('pycln') . ' --some-flag' . b:cmd_tail
let g:ale_python_pycln_options = '--some-option value' AssertLinter 'foo', ale#Escape('foo') . ' --some-flag' . b:cmd_tail
AssertLinter 'pycln', ale#Escape('pycln') . ' --some-option value' . b:cmd_tail
Execute(The pycln callbacks shouldn't detect virtualenv directories where they don't exist): Execute(The pycln callbacks shouldn't detect virtualenv directories where they don't exist):
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py') call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
@@ -121,4 +114,3 @@ Execute(configuration file set in _options overrides _config):
let b:ale_python_pycln_options = '-x --config /bar.xml' let b:ale_python_pycln_options = '-x --config /bar.xml'
AssertLinter 'pycln', ale#Escape('pycln') . ' -x --config /bar.xml' . b:cmd_tail AssertLinter 'pycln', ale#Escape('pycln') . ' -x --config /bar.xml' . b:cmd_tail

View File

@@ -13,20 +13,17 @@ After:
call ale#test#SetFilename('..') call ale#test#SetFilename('..')
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The pylsp command callback should return default string): Execute(The default pylsp command should be correct):
call ale#test#SetFilename('./foo.py') call ale#test#SetFilename('./foo.py')
AssertLinter 'pylsp', ale#Escape('pylsp') AssertLinter 'pylsp', ale#Escape('pylsp')
Execute(The pylsp executable should be configurable): Execute(The pylsp command and executable should be configurable):
let g:ale_python_pylsp_executable = '~/.local/bin/pylsp' let g:ale_python_pylsp_executable = '~/.local/bin/pylsp'
AssertLinter '~/.local/bin/pylsp' , ale#Escape('~/.local/bin/pylsp')
Execute(The pylsp command callback should let you set options):
let g:ale_python_pylsp_options = '--some-option' let g:ale_python_pylsp_options = '--some-option'
AssertLinter 'pylsp', ale#Escape('pylsp') . ' --some-option' AssertLinter '~/.local/bin/pylsp' , ale#Escape('~/.local/bin/pylsp')
\ . ' --some-option'
Execute(The cwd and project root should be detected correctly): Execute(The cwd and project root should be detected correctly):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py') call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')

View File

@@ -1,5 +1,4 @@
" Author: januswel, w0rp " Author: januswel, w0rp
Before: Before:
" This is just one language for the linter. " This is just one language for the linter.
call ale#assert#SetUpLinterTest('rst', 'textlint') call ale#assert#SetUpLinterTest('rst', 'textlint')
@@ -18,28 +17,22 @@ Before:
unlet! b:ale_textlint_options unlet! b:ale_textlint_options
After: After:
unlet! b:command_tail
unlet! b:ale_textlint_executable unlet! b:ale_textlint_executable
unlet! b:ale_textlint_use_global unlet! b:ale_textlint_use_global
unlet! b:ale_textlint_options unlet! b:ale_textlint_options
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default textlint command should be correct):
AssertLinter 'textlint', AssertLinter 'textlint',
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
Execute(The executable should be configurable): Execute(The text executable and command should be configurable):
let b:ale_textlint_executable = 'foobar' let b:ale_textlint_executable = 'foobar'
AssertLinter 'foobar',
\ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
Execute(The options should be configurable):
let b:ale_textlint_options = '--something' let b:ale_textlint_options = '--something'
AssertLinter 'textlint', AssertLinter 'foobar',
\ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' \ ale#Escape('foobar') . ' --something -f json --stdin --stdin-filename %s'
Execute(The local executable from .bin should be used if available): Execute(The local executable from .bin should be used if available):
call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt')

View File

@@ -4,19 +4,12 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default sqlfluff command should be correct):
AssertLinter 'sqlfluff', AssertLinter 'sqlfluff',
\ ale#Escape('sqlfluff') \ ale#Escape('sqlfluff')
\ . ' lint --dialect ansi --format json %t' \ . ' lint --dialect ansi --format json %t'
Execute(The executable should be configurable): Execute(The sqlfluff executable and command should be configurable):
let g:ale_sql_sqlfluff_executable = 'foobar'
AssertLinter 'foobar',
\ ale#Escape('foobar')
\ . ' lint --dialect ansi --format json %t'
Execute(Overriding options should work):
let g:ale_sql_sqlfluff_executable = 'foobar' let g:ale_sql_sqlfluff_executable = 'foobar'
let g:ale_sql_sqlfluff_options = '--whatever' let g:ale_sql_sqlfluff_options = '--whatever'

View File

@@ -8,34 +8,29 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(Should send correct LSP language): Execute(The terraform-ls language should be correct):
AssertLSPLanguage 'terraform' AssertLSPLanguage 'terraform'
Execute(Should load default executable): Execute(The default terraform-ls command should be correct):
AssertLinter 'terraform-ls', AssertLinter 'terraform-ls', ale#Escape('terraform-ls') . ' serve'
\ ale#Escape('terraform-ls') . ' serve'
Execute(Should configure custom executable): Execute(The terrarform-ls executable and options should be configurable):
let b:ale_terraform_ls_executable = 'foo' let b:ale_terraform_ls_executable = 'foo'
AssertLinter 'foo', let b:ale_terraform_ls_options = '--bar'
\ ale#Escape('foo') . ' serve'
Execute(Should ignore non-absolute custom terraform executable): AssertLinter 'foo', ale#Escape('foo') . ' serve --bar'
Execute(Should ignore non-absolute path custom terraform executables):
let b:ale_terraform_terraform_executable = 'terraform' let b:ale_terraform_terraform_executable = 'terraform'
AssertLinter 'terraform-ls',
\ ale#Escape('terraform-ls') . ' serve' AssertLinter 'terraform-ls', ale#Escape('terraform-ls') . ' serve'
Execute(Should set absolute custom terraform executable): Execute(Should set absolute custom terraform executable):
let b:ale_terraform_terraform_executable = '/bin/terraform' let b:ale_terraform_terraform_executable = '/bin/terraform'
AssertLinter 'terraform-ls', AssertLinter 'terraform-ls',
\ ale#Escape('terraform-ls') . ' serve -tf-exec /bin/terraform' \ ale#Escape('terraform-ls') . ' serve -tf-exec /bin/terraform'
Execute(Should set custom options):
let b:ale_terraform_ls_options = '--bar'
AssertLinter 'terraform-ls',
\ ale#Escape('terraform-ls') . ' serve --bar'
Execute(Should return nearest directory with .terraform if found in parent directory): Execute(Should return nearest directory with .terraform if found in parent directory):
call ale#test#SetFilename('../test-files/terraform/main.tf') call ale#test#SetFilename('../test-files/terraform/main.tf')

View File

@@ -4,15 +4,10 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default tflint command should be correct):
AssertLinter 'tflint', ale#Escape('tflint') . ' -f json' AssertLinter 'tflint', ale#Escape('tflint') . ' -f json'
Execute(The default executable should be configurable): Execute(Test tflint executable and command should be configurable):
let b:ale_terraform_tflint_executable = 'asdf'
AssertLinter 'asdf', ale#Escape('asdf') . ' -f json'
Execute(Overriding options should work):
let g:ale_terraform_tflint_executable = 'fnord' let g:ale_terraform_tflint_executable = 'fnord'
let g:ale_terraform_tflint_options = '--whatever' let g:ale_terraform_tflint_options = '--whatever'

View File

@@ -25,21 +25,16 @@ After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default textlint command should be correct):
AssertLinter 'textlint', AssertLinter 'textlint',
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s' \ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
Execute(The executable should be configurable): Execute(The textlint executable and options should be configurable):
let b:ale_textlint_executable = 'foobar' let b:ale_textlint_executable = 'foobar'
AssertLinter 'foobar',
\ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
Execute(The options should be configurable):
let b:ale_textlint_options = '--something' let b:ale_textlint_options = '--something'
AssertLinter 'textlint', AssertLinter 'foobar',
\ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s' \ ale#Escape('foobar') . ' --something -f json --stdin --stdin-filename %s'
Execute(The local executable from .bin should be used if available): Execute(The local executable from .bin should be used if available):
call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt') call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt')

View File

@@ -8,14 +8,9 @@ Execute(The default command should be correct):
AssertLinter 'thriftcheck', ale#Escape('thriftcheck') AssertLinter 'thriftcheck', ale#Escape('thriftcheck')
\ . ' --stdin-filename %s %t' \ . ' --stdin-filename %s %t'
Execute(The executable should be configurable): Execute(The executable and options should be configurable):
let b:ale_thrift_thriftcheck_executable = 'foobar' let b:ale_thrift_thriftcheck_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar')
\ . ' --stdin-filename %s %t'
Execute(The string of options should be configurable):
let b:ale_thrift_thriftcheck_options = '--errors-only' let b:ale_thrift_thriftcheck_options = '--errors-only'
AssertLinter 'thriftcheck', ale#Escape('thriftcheck') AssertLinter 'foobar', ale#Escape('foobar')
\ . ' --errors-only --stdin-filename %s %t' \ . ' --errors-only --stdin-filename %s %t'

View File

@@ -1,5 +1,10 @@
Before: Before:
let g:ale_deno_importMap = 'import_map.json' Save g:ale_deno_import_map
Save g:ale_deno_unstable
Save g:ale_deno_executable
Save g:ale_deno_lsp_project_root
let g:ale_deno_import_map = 'import_map.json'
let g:ale_deno_unstable = 0 let g:ale_deno_unstable = 0
let g:ale_deno_executable = 'deno' let g:ale_deno_executable = 'deno'
let g:ale_deno_lsp_project_root = '' let g:ale_deno_lsp_project_root = ''
@@ -50,7 +55,7 @@ Execute(Should set the importMap filepath from user defined importMap):
\} \}
Execute(Should set the importMap filepath from user defined importMap with unstable API): Execute(Should set the importMap filepath from user defined importMap with unstable API):
let g:ale_deno_importMap = 'custom_import_map.json' let g:ale_deno_import_map = 'custom_import_map.json'
let g:ale_deno_unstable = 1 let g:ale_deno_unstable = 1
call ale#test#SetFilename('../test-files/typescript/test.ts') call ale#test#SetFilename('../test-files/typescript/test.ts')

View File

@@ -1,25 +1,14 @@
Before: Before:
Save g:ale_v_v_executable
call ale#assert#SetUpLinterTest('v', 'v') call ale#assert#SetUpLinterTest('v', 'v')
GivenCommandOutput ['/foo/bar', '/foo/baz']
After: After:
Restore
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The default command should be correct): Execute(The default v command should be correct):
AssertLinter 'v', 'v . -o /tmp/vim-ale-v' AssertLinter 'v', ale#Escape('v') . ' . -o /tmp/vim-ale-v'
Execute(Extra options should be supported): Execute(The v executable and options should be configurable):
let g:ale_v_v_executable = 'foobar'
let g:ale_v_v_options = '--foo-bar' let g:ale_v_v_options = '--foo-bar'
AssertLinter 'v', 'v --foo-bar . -o /tmp/vim-ale-v' AssertLinter 'foobar', ale#Escape('foobar') . ' --foo-bar . -o /tmp/vim-ale-v'
let g:ale_v_vbuild_options = ''
Execute(The executable should be configurable):
let g:ale_v_v_executable = 'foobar'
AssertLinter 'foobar', 'foobar . -o /tmp/vim-ale-v'

View File

@@ -56,6 +56,7 @@ Execute(Setting executable to 'pipenv' appends 'run vulture'):
let g:ale_python_vulture_executable = 'path/to/pipenv' let g:ale_python_vulture_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run vulture' . ' .' AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run vulture' . ' .'
Execute(Setting executable to 'poetry' appends 'run vulture'): Execute(Setting executable to 'poetry' appends 'run vulture'):
let g:ale_python_vulture_executable = 'path/to/poetry' let g:ale_python_vulture_executable = 'path/to/poetry'

View File

@@ -9,15 +9,12 @@ Before:
After: After:
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The XO executable should be called): Execute(The default xo command should be correct):
AssertLinter 'xo', ale#Escape('xo') . ' --reporter json --stdin --stdin-filename %s' AssertLinter 'xo', ale#Escape('xo') . ' --reporter json --stdin --stdin-filename %s'
Execute(The XO executable should be configurable): Execute(The xo executable and command should be configurable):
let b:ale_javascript_xo_executable = 'foobar' let b:ale_javascript_xo_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' --reporter json --stdin --stdin-filename %s'
Execute(The XO options should be configurable):
let b:ale_javascript_xo_options = '--wat' let b:ale_javascript_xo_options = '--wat'
AssertLinter 'xo', ale#Escape('xo') . ' --wat --reporter json --stdin --stdin-filename %s' AssertLinter 'foobar', ale#Escape('foobar')
\ . ' --wat --reporter json --stdin --stdin-filename %s'

View File

@@ -2,18 +2,13 @@ Before:
call ale#assert#SetUpLinterTest('vhdl', 'xvhdl') call ale#assert#SetUpLinterTest('vhdl', 'xvhdl')
After: After:
unlet! b:command_tail
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The default xvhdl command should be correct):
AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --2008 %t' AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --2008 %t'
Execute(The xvhdl executable and options should be configurable):
let b:ale_vhdl_xvhdl_executable = 'foobar' let b:ale_vhdl_xvhdl_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' --2008 %t'
Execute(The options should be configurable):
let b:ale_vhdl_xvhdl_options = '--something' let b:ale_vhdl_xvhdl_options = '--something'
AssertLinter 'xvhdl', ale#Escape('xvhdl') . ' --something %t' AssertLinter 'foobar', ale#Escape('foobar') . ' --something %t'

View File

@@ -2,8 +2,6 @@ Before:
call ale#assert#SetUpLinterTest('verilog', 'xvlog') call ale#assert#SetUpLinterTest('verilog', 'xvlog')
After: After:
unlet! b:command_tail
call ale#assert#TearDownLinterTest() call ale#assert#TearDownLinterTest()
Execute(The executable should be configurable): Execute(The executable should be configurable):

View File

@@ -19,11 +19,12 @@ After:
Execute(ale#lsp_window#HandleShowMessage() should only show errors when severity is set to "error"): Execute(ale#lsp_window#HandleShowMessage() should only show errors when severity is set to "error"):
let g:ale_lsp_show_message_severity = 'error' let g:ale_lsp_show_message_severity = 'error'
call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an error'}) " We should escape the quotes from this message.
call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':1,'message':'an ''error'''})
call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'}) call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':2,'message':'a warning'})
call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'}) call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':'an info'})
call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'}) call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':4,'message':'a log'})
AssertEqual ['Error:some_linter: an error'], g:expr_list AssertEqual ['Error:some_linter: an ''error'''], g:expr_list
Execute(ale#lsp_window#HandleShowMessage() should only show errors and warnings when severity is set to "warning"): Execute(ale#lsp_window#HandleShowMessage() should only show errors and warnings when severity is set to "warning"):
let g:ale_lsp_show_message_severity = 'warning' let g:ale_lsp_show_message_severity = 'warning'
@@ -88,7 +89,3 @@ Execute(ale#lsp_window#HandleShowMessage() should use "warning" when severity is
\ 'Error:some_linter: an error', \ 'Error:some_linter: an error',
\ 'Warning:some_linter: a warning'], \ 'Warning:some_linter: a warning'],
\ g:expr_list \ g:expr_list
Execute(ale#lsp_window#HandleShowMessage() should escape quotes on messages):
call ale#lsp_window#HandleShowMessage(g:linter_name, g:format, {'type':3,'message':"this is an 'info'"})
AssertEqual ['Info:some_linter: this is an ''info'''], g:expr_list

View File

@@ -40,11 +40,6 @@ Execute(0 signs should be set when the max is 0):
AssertEqual [], SetNProblems(42) AssertEqual [], SetNProblems(42)
Execute(1 signs should be set when the max is 1):
let g:ale_max_signs = 1
AssertEqual [1], SetNProblems(42)
Execute(10 signs should be set when the max is 10): Execute(10 signs should be set when the max is 10):
let g:ale_max_signs = 10 let g:ale_max_signs = 10

View File

@@ -133,11 +133,11 @@ Execute(ale#sign#GetSignName should return the right sign names):
\]) \])
Given testft(A file with warnings/errors): Given testft(A file with warnings/errors):
foo Foo
bar Bar
baz Baz
fourth line Fourth line
fifth line Fifth line
Execute(The current signs should be set for running a job): Execute(The current signs should be set for running a job):
ALELint ALELint
@@ -277,26 +277,6 @@ Execute(Signs should be upgraded correctly):
\ sort(ParseSigns()) \ sort(ParseSigns())
Execute(It should be possible to clear signs with empty lists): Execute(It should be possible to clear signs with empty lists):
let g:loclist = [
\ {'bufnr': bufnr(''), 'lnum': 16, 'col': 2, 'type': 'E', 'text': 'f'},
\]
call ale#sign#SetSigns(bufnr(''), g:loclist)
AssertEqual
\ [
\ ['16', '1000001', 'ALEErrorSign'],
\ ],
\ sort(ParseSigns())
call ale#sign#SetSigns(bufnr(''), [])
AssertEqual [], ParseSigns()
Execute(No exceptions should be thrown when setting signs for invalid buffers):
call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}])
Execute(Signs should be removed when lines have multiple sign IDs on them):
" We can fail to remove signs if there are multiple signs on one line, " We can fail to remove signs if there are multiple signs on one line,
" say after deleting lines in Vim, etc. " say after deleting lines in Vim, etc.
if has('nvim-0.4.2') || has('patch-8.1.614') if has('nvim-0.4.2') || has('patch-8.1.614')
@@ -313,3 +293,6 @@ Execute(Signs should be removed when lines have multiple sign IDs on them):
call ale#sign#SetSigns(bufnr(''), []) call ale#sign#SetSigns(bufnr(''), [])
AssertEqual [], ParseSigns() AssertEqual [], ParseSigns()
Execute(No exceptions should be thrown when setting signs for invalid buffers):
call ale#sign#SetSigns(123456789, [{'lnum': 15, 'col': 2, 'type': 'W', 'text': 'e'}])