mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-04 09:02:52 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -18,11 +18,10 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc') . ' -x ada -c -gnatc'
|
||||
\ . ' -o ' . b:out_file
|
||||
\ . ' -I ' . ale#Escape(getcwd())
|
||||
\ . ' -I %s:h'
|
||||
\ . ' -gnatwa -gnatq %t'
|
||||
|
||||
let b:ale_ada_gcc_executable = 'foo'
|
||||
@@ -30,15 +29,14 @@ Execute(The executable should be configurable):
|
||||
AssertLinter 'foo',
|
||||
\ ale#Escape('foo') . ' -x ada -c -gnatc'
|
||||
\ . ' -o ' . b:out_file
|
||||
\ . ' -I ' . ale#Escape(getcwd())
|
||||
\ . ' -I %s:h'
|
||||
\ . ' -gnatwa -gnatq %t'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
|
||||
let g:ale_ada_gcc_options = '--foo --bar'
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc') . ' -x ada -c -gnatc'
|
||||
\ . ' -o ' . b:out_file
|
||||
\ . ' -I ' . ale#Escape(getcwd())
|
||||
\ . ' -I %s:h'
|
||||
\ . ' --foo --bar %t'
|
||||
|
||||
@@ -3,7 +3,7 @@ Before:
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
let b:command_tail = ' -x assembler'
|
||||
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . '-iquote ' . ale#Escape(g:dir)
|
||||
\ . '-iquote %s:h'
|
||||
\ . ' -Wall -'
|
||||
|
||||
After:
|
||||
|
||||
@@ -23,7 +23,7 @@ Before:
|
||||
|
||||
let b:command_tail = ' -S -x c'
|
||||
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(getcwd())
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -std=c11 -Wall -'
|
||||
|
||||
After:
|
||||
|
||||
@@ -43,7 +43,7 @@ Execute(The C cc linter should include 'include' directories for projects with a
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
@@ -55,7 +55,7 @@ Execute(The C cc linter should include 'include' directories for projects with a
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
@@ -67,7 +67,7 @@ Execute(The C cc linter should include root directories for projects with .h fil
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
@@ -79,7 +79,7 @@ Execute(The C cc linter should include root directories for projects with .hpp f
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
@@ -101,7 +101,7 @@ Execute(The C++ cc linter should include 'include' directories for projects with
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
@@ -113,7 +113,7 @@ Execute(The C++ cc linter should include 'include' directories for projects with
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
@@ -125,7 +125,7 @@ Execute(The C++ cc linter should include root directories for projects with .h f
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
@@ -137,7 +137,7 @@ Execute(The C++ cc linter should include root directories for projects with .hpp
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Before:
|
||||
|
||||
let b:command_tail = ' -S -x c++'
|
||||
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote ' . ale#Escape(getcwd())
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -std=c++14 -Wall -'
|
||||
|
||||
After:
|
||||
@@ -11,14 +11,14 @@ After:
|
||||
|
||||
Execute(The default commands should be correct):
|
||||
AssertLinter 'go',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'go test -c -o /dev/null ./'
|
||||
|
||||
Execute(Go environment variables should be supported):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'go',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Env('GO111MODULE', 'on')
|
||||
\ . 'go test -c -o /dev/null ./'
|
||||
|
||||
@@ -28,7 +28,7 @@ Execute(Extra options should be supported):
|
||||
let g:ale_go_gobuild_options = '--foo-bar'
|
||||
|
||||
AssertLinter 'go',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'go test --foo-bar -c -o /dev/null ./'
|
||||
|
||||
let g:ale_go_gobuild_options = ''
|
||||
@@ -37,5 +37,5 @@ Execute(The executable should be configurable):
|
||||
let g:ale_go_go_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'foobar test -c -o /dev/null ./'
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
Save b:ale_go_go111module
|
||||
|
||||
let b:ale_go_go111module = ''
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gofmt')
|
||||
call ale#test#SetFilename('../go_files/testfile2.go')
|
||||
|
||||
@@ -13,7 +13,7 @@ After:
|
||||
|
||||
Execute(The golangci-lint defaults should be correct):
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('golangci-lint')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
\ . ' --enable-all'
|
||||
@@ -22,7 +22,7 @@ Execute(The golangci-lint callback should use a configured executable):
|
||||
let b:ale_go_golangci_lint_executable = 'something else'
|
||||
|
||||
AssertLinter 'something else',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('something else')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
\ . ' --enable-all'
|
||||
@@ -31,7 +31,7 @@ Execute(The golangci-lint callback should use configured options):
|
||||
let b:ale_go_golangci_lint_options = '--foobar'
|
||||
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('golangci-lint')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
\ . ' --foobar'
|
||||
@@ -40,7 +40,7 @@ Execute(The golangci-lint callback should support environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Env('GO111MODULE', 'on')
|
||||
\ . ale#Escape('golangci-lint')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
@@ -50,5 +50,5 @@ Execute(The golangci-lint `lint_package` option should use the correct command):
|
||||
let b:ale_go_golangci_lint_package = 1
|
||||
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('golangci-lint') . ' run --enable-all'
|
||||
|
||||
@@ -13,7 +13,7 @@ After:
|
||||
|
||||
Execute(The gometalinter defaults should be correct):
|
||||
AssertLinter 'gometalinter',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' .'
|
||||
@@ -22,7 +22,7 @@ Execute(The gometalinter callback should use a configured executable):
|
||||
let b:ale_go_gometalinter_executable = 'something else'
|
||||
|
||||
AssertLinter 'something else',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('something else')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' .'
|
||||
@@ -31,7 +31,7 @@ Execute(The gometalinter callback should use configured options):
|
||||
let b:ale_go_gometalinter_options = '--foobar'
|
||||
|
||||
AssertLinter 'gometalinter',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' --foobar' . ' .'
|
||||
@@ -40,7 +40,7 @@ Execute(The gometalinter should use configured environment variables):
|
||||
let b:ale_go_go111module = 'off'
|
||||
|
||||
AssertLinter 'gometalinter',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Env('GO111MODULE', 'off')
|
||||
\ . ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
@@ -50,5 +50,5 @@ Execute(The gometalinter `lint_package` option should use the correct command):
|
||||
let b:ale_go_gometalinter_lint_package = 1
|
||||
|
||||
AssertLinter 'gometalinter',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('gometalinter') . ' .'
|
||||
|
||||
@@ -11,11 +11,12 @@ After:
|
||||
|
||||
Execute(The default gosimple command should be correct):
|
||||
AssertLinter 'gosimple',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ' gosimple .'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ' gosimple .'
|
||||
|
||||
Execute(The gosimple command should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'gosimple',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ' '
|
||||
\ . ale#Env('GO111MODULE', 'on') . 'gosimple .'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ' ' . ale#Env('GO111MODULE', 'on') . 'gosimple .'
|
||||
|
||||
@@ -11,7 +11,8 @@ After:
|
||||
|
||||
Execute(The default gotype command should be correct):
|
||||
AssertLinter 'gotype',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ' gotype -e .'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ' gotype -e .'
|
||||
|
||||
Execute(The gotype callback should ignore test files):
|
||||
call ale#test#SetFilename('bla_test.go')
|
||||
@@ -22,6 +23,6 @@ Execute(The gotype callback should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'gotype',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ' '
|
||||
\ . ale#Env('GO111MODULE', 'on')
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ' ' . ale#Env('GO111MODULE', 'on')
|
||||
\ . 'gotype -e .'
|
||||
|
||||
@@ -13,22 +13,22 @@ After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet .'
|
||||
AssertLinter 'go', ale#path#BufferCdString(bufnr('')) . ' go vet .'
|
||||
|
||||
Execute(Extra options should be supported):
|
||||
let g:ale_go_govet_options = '--foo-bar'
|
||||
|
||||
AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet --foo-bar .'
|
||||
AssertLinter 'go', ale#path#BufferCdString(bufnr('')) . ' go vet --foo-bar .'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_go_go_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#path#CdString(expand('%:p:h')) . ' foobar vet .'
|
||||
AssertLinter 'foobar', ale#path#BufferCdString(bufnr('')) . ' foobar vet .'
|
||||
|
||||
Execute(Go environment variables should be supported):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'go',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ' '
|
||||
\ ale#path#BufferCdString(bufnr('')) . ' '
|
||||
\ . ale#Env('GO111MODULE', 'on')
|
||||
\ . 'go vet .'
|
||||
|
||||
@@ -6,6 +6,6 @@ After:
|
||||
|
||||
Execute(The linter should run from the directory of the file in the buffer):
|
||||
AssertLinter 'gqlint',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'gqlint --reporter=simple'
|
||||
\ . ' %t'
|
||||
|
||||
@@ -3,7 +3,7 @@ Before:
|
||||
call ale#test#SetFilename('dummy.java')
|
||||
|
||||
let g:cp_sep = has('unix') ? ':' : ';'
|
||||
let g:prefix = ale#path#CdString(expand('%:p:h'))
|
||||
let g:prefix = ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
|
||||
function! GetCommand(previous_output) abort
|
||||
@@ -51,7 +51,7 @@ Execute(The executable should be configurable):
|
||||
let g:ale_java_javac_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('foobar') . ' -Xlint'
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
@@ -197,7 +197,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
|
||||
@@ -210,7 +211,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
|
||||
@@ -223,7 +225,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/')
|
||||
@@ -238,7 +241,8 @@ Execute(The javac callback should combine discovered sourcepath and manual ones)
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/build/gen/main/'),
|
||||
@@ -253,7 +257,8 @@ Execute(The javac callback should detect source directories):
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
||||
\ )
|
||||
@@ -272,7 +277,8 @@ Execute(The javac callback should combine detected source directories and classp
|
||||
\], {})
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
||||
@@ -294,7 +300,8 @@ Execute(The javac callback should include src/test/java for test paths):
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/test/java/'),
|
||||
@@ -307,7 +314,8 @@ Execute(The javac callback should include src/main/jaxb when available):
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/jaxb/'),
|
||||
@@ -320,7 +328,8 @@ Execute(The javac callback should add -sourcepath even if src/java/main doesn't
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ ale#path#CdString(expand('%:p:h')) . ale#Escape('javac') . ' -Xlint'
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths_no_main/src/test/java/'),
|
||||
\ ], g:cp_sep))
|
||||
|
||||
@@ -6,7 +6,7 @@ After:
|
||||
|
||||
Execute(The default lintr command should be correct):
|
||||
AssertLinter 'Rscript',
|
||||
\ ale#path#CdString(getcwd())
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'Rscript --vanilla -e '
|
||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||
@@ -17,7 +17,7 @@ Execute(The lintr options should be configurable):
|
||||
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
|
||||
|
||||
AssertLinter 'Rscript',
|
||||
\ ale#path#CdString(getcwd())
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'Rscript --vanilla -e '
|
||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||
@@ -28,7 +28,7 @@ Execute(If the lint_package flag is set, lintr::lint_package should be called):
|
||||
let b:ale_r_lintr_lint_package = 1
|
||||
|
||||
AssertLinter 'Rscript',
|
||||
\ ale#path#CdString(getcwd())
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'Rscript --vanilla -e '
|
||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||
\ . 'lint_package(cache = FALSE, '
|
||||
|
||||
@@ -75,14 +75,14 @@ Execute(Setting executable to 'pipenv' appends 'run mypy'):
|
||||
let g:ale_python_mypy_executable = 'path/to/pipenv'
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('path/to/pipenv') . ' run mypy'
|
||||
\ . ' --show-column-numbers --shadow-file %s %t %s'
|
||||
|
||||
Execute(Pipenv is detected when python_mypy_auto_pipenv is set):
|
||||
let g:ale_python_mypy_auto_pipenv = 1
|
||||
call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
|
||||
call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('pipenv') . ' run mypy --show-column-numbers --shadow-file %s %t %s'
|
||||
|
||||
@@ -2,9 +2,9 @@ Before:
|
||||
call ale#assert#SetUpLinterTest('nasm', 'nasm')
|
||||
|
||||
let b:command_tail =
|
||||
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||
\ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||
let b:command_tail_opt =
|
||||
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||
\ ' -X gnu -I %s:h' . (has('win32') ? '\' : '/') . ' -w+orphan-labels %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||
|
||||
After:
|
||||
unlet! b:command_tail
|
||||
@@ -23,7 +23,8 @@ Execute(The options should be configurable):
|
||||
let b:ale_nasm_nasm_options = '-w-macro-params'
|
||||
|
||||
AssertLinter 'nasm', ale#Escape('nasm')
|
||||
\ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||
\ . ' -X gnu -I %s:h' . (has('win32') ? '\' : '/')
|
||||
\ . ' -w-macro-params %s -o ' . (has('win32') ? 'NUL' : '/dev/null')
|
||||
|
||||
Execute(The options should be used in command):
|
||||
let b:ale_nasm_nasm_options = '-w+orphan-labels'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('python', 'pydocstyle')
|
||||
call ale#test#SetFilename('test.py')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
@@ -7,33 +8,33 @@ After:
|
||||
Execute(The pydocstyle command callback should return default string):
|
||||
AssertLinter 'pydocstyle',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('pydocstyle') . ' ' . ale#Escape('dummy.txt')
|
||||
\ . ale#Escape('pydocstyle') . ' %s:t'
|
||||
|
||||
Execute(The pydocstyle command callback should allow options):
|
||||
let g:ale_python_pydocstyle_options = '--verbose'
|
||||
|
||||
AssertLinter 'pydocstyle',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('pydocstyle') . ' --verbose ' . ale#Escape('dummy.txt')
|
||||
\ . ale#Escape('pydocstyle') . ' --verbose %s:t'
|
||||
|
||||
Execute(The pydocstyle executable should be configurable):
|
||||
let g:ale_python_pydocstyle_executable = '~/.local/bin/pydocstyle'
|
||||
|
||||
AssertLinter '~/.local/bin/pydocstyle',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('~/.local/bin/pydocstyle') . ' ' . ale#Escape('dummy.txt')
|
||||
\ . ale#Escape('~/.local/bin/pydocstyle') . ' %s:t'
|
||||
|
||||
Execute(Setting executable to 'pipenv' appends 'run pydocstyle'):
|
||||
let g:ale_python_pydocstyle_executable = 'path/to/pipenv'
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('path/to/pipenv') . ' run pydocstyle ' . ale#Escape('dummy.txt')
|
||||
\ . ale#Escape('path/to/pipenv') . ' run pydocstyle %s:t'
|
||||
|
||||
Execute(Pipenv is detected when python_pydocstyle_auto_pipenv is set):
|
||||
let g:ale_python_pydocstyle_auto_pipenv = 1
|
||||
call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
|
||||
call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('pipenv') . ' run pydocstyle ' . ale#Escape('whatever.py')
|
||||
\ . ale#Escape('pipenv') . ' run pydocstyle %s:t'
|
||||
|
||||
@@ -14,7 +14,7 @@ After:
|
||||
|
||||
Execute(The pylama command callback should return a default):
|
||||
AssertLinter 'pylama',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('pylama') . b:command_tail
|
||||
|
||||
Execute(The option for disabling changing directories should work):
|
||||
@@ -26,14 +26,14 @@ Execute(The pylama executable should be configurable, and escaped properly):
|
||||
let g:ale_python_pylama_executable = 'executable with spaces'
|
||||
|
||||
AssertLinter 'executable with spaces',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('executable with spaces') . b:command_tail
|
||||
|
||||
Execute(The pylama command callback should let you set options):
|
||||
let g:ale_python_pylama_options = '--some-option'
|
||||
|
||||
AssertLinter 'pylama',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('pylama') . ' --some-option' . b:command_tail
|
||||
|
||||
Execute(The pylama command callback should switch directories to the detected project root):
|
||||
@@ -73,13 +73,13 @@ Execute(Setting executable to 'pipenv' appends 'run pylama'):
|
||||
let g:ale_python_pylama_executable = 'path/to/pipenv'
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('path/to/pipenv') . ' run pylama' . b:command_tail
|
||||
|
||||
Execute(Pipenv is detected when python_pylama_auto_pipenv is set):
|
||||
let g:ale_python_pylama_auto_pipenv = 1
|
||||
call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
|
||||
call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('pipenv') . ' run pylama' . b:command_tail
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
Before:
|
||||
Save g:ale_python_auto_pipenv
|
||||
|
||||
let g:ale_python_auto_pipenv = 0
|
||||
|
||||
call ale#assert#SetUpLinterTest('python', 'pylint')
|
||||
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
@@ -13,7 +17,7 @@ After:
|
||||
|
||||
Execute(The pylint callbacks should return the correct default values):
|
||||
AssertLinter 'pylint',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('pylint') . ' ' . b:command_tail
|
||||
|
||||
Execute(The option for disabling changing directories should work):
|
||||
@@ -25,14 +29,14 @@ Execute(The pylint executable should be configurable, and escaped properly):
|
||||
let g:ale_python_pylint_executable = 'executable with spaces'
|
||||
|
||||
AssertLinter 'executable with spaces',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('executable with spaces') . ' ' . b:command_tail
|
||||
|
||||
Execute(The pylint command callback should let you set options):
|
||||
let g:ale_python_pylint_options = '--some-option'
|
||||
|
||||
AssertLinter 'pylint',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('pylint') . ' --some-option' . b:command_tail
|
||||
|
||||
Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
|
||||
@@ -65,15 +69,15 @@ Execute(Setting executable to 'pipenv' appends 'run pylint'):
|
||||
let g:ale_python_pylint_executable = 'path/to/pipenv'
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('path/to/pipenv') . ' run pylint'
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
||||
|
||||
Execute(Pipenv is detected when python_pylint_auto_pipenv is set):
|
||||
let g:ale_python_pylint_auto_pipenv = 1
|
||||
call ale#test#SetFilename('/testplugin/test/python_fixtures/pipenv/whatever.py')
|
||||
call ale#test#SetFilename('../python_fixtures/pipenv/whatever.py')
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('pipenv') . ' run pylint'
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n %s'
|
||||
|
||||
@@ -6,8 +6,8 @@ After:
|
||||
|
||||
Execute(The default cython command should be correct):
|
||||
AssertLinter 'cython', ale#Escape('cython')
|
||||
\ . ' --working ' . ale#Escape(g:dir)
|
||||
\ . ' --include-dir ' . ale#Escape(g:dir)
|
||||
\ . ' --working %s:h'
|
||||
\ . ' --include-dir %s:h'
|
||||
\ . ' --warning-extra'
|
||||
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
|
||||
|
||||
@@ -15,8 +15,8 @@ Execute(The cython executable should be configurable):
|
||||
let b:ale_pyrex_cython_executable = 'cython_foobar'
|
||||
|
||||
AssertLinter 'cython_foobar', ale#Escape('cython_foobar')
|
||||
\ . ' --working ' . ale#Escape(g:dir)
|
||||
\ . ' --include-dir ' . ale#Escape(g:dir)
|
||||
\ . ' --working %s:h'
|
||||
\ . ' --include-dir %s:h'
|
||||
\ . ' --warning-extra'
|
||||
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
|
||||
|
||||
@@ -24,7 +24,7 @@ Execute(Additional cython options should be configurable):
|
||||
let b:ale_pyrex_cython_options = '--foobar'
|
||||
|
||||
AssertLinter 'cython', ale#Escape('cython')
|
||||
\ . ' --working ' . ale#Escape(g:dir)
|
||||
\ . ' --include-dir ' . ale#Escape(g:dir)
|
||||
\ . ' --working %s:h'
|
||||
\ . ' --include-dir %s:h'
|
||||
\ . ' --foobar'
|
||||
\ . ' --output-file ' . g:ale#util#nul_file . ' %t'
|
||||
|
||||
@@ -10,20 +10,17 @@ After:
|
||||
|
||||
Execute(Executable should default to rubocop):
|
||||
AssertLinter 'rubocop', ale#Escape('rubocop')
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_ruby_rubocop_executable = 'bin/rubocop'
|
||||
|
||||
AssertLinter 'bin/rubocop' , ale#Escape('bin/rubocop')
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
Execute(Setting bundle appends 'exec rubocop'):
|
||||
let g:ale_ruby_rubocop_executable = 'path to/bundle'
|
||||
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
|
||||
\ . ' exec rubocop'
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
@@ -10,20 +10,17 @@ After:
|
||||
|
||||
Execute(Executable should default to ruumba):
|
||||
AssertLinter 'ruumba', ale#Escape('ruumba')
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_eruby_ruumba_executable = 'bin/ruumba'
|
||||
|
||||
AssertLinter 'bin/ruumba' , ale#Escape('bin/ruumba')
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
Execute(Setting bundle appends 'exec ruumba'):
|
||||
let g:ale_eruby_ruumba_executable = 'path to/bundle'
|
||||
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
|
||||
\ . ' exec ruumba'
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.html.erb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
@@ -2,7 +2,7 @@ Before:
|
||||
call ale#assert#SetUpLinterTest('sh', 'shellcheck')
|
||||
call ale#test#SetFilename('test.sh')
|
||||
|
||||
let b:prefix = ale#path#CdString(ale#path#Simplify(g:dir))
|
||||
let b:prefix = ale#path#BufferCdString(bufnr(''))
|
||||
let b:suffix = ' -f gcc -'
|
||||
|
||||
After:
|
||||
|
||||
12
test/command_callback/test_sqllint_command_callback.vader
Normal file
12
test/command_callback/test_sqllint_command_callback.vader
Normal file
@@ -0,0 +1,12 @@
|
||||
Before:
|
||||
" Load the linter and set up a series of commands, reset linter variables,
|
||||
" clear caches, etc.
|
||||
"
|
||||
" Vader's 'Save' command will be called here for linter variables.
|
||||
call ale#assert#SetUpLinterTest('sql', 'sqllint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'sql-lint', ['sql-lint']
|
||||
@@ -10,20 +10,17 @@ After:
|
||||
|
||||
Execute(Executable should default to standardrb):
|
||||
AssertLinter 'standardrb', ale#Escape('standardrb')
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_ruby_standardrb_executable = 'bin/standardrb'
|
||||
|
||||
AssertLinter 'bin/standardrb' , ale#Escape('bin/standardrb')
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
Execute(Setting bundle appends 'exec standardrb'):
|
||||
let g:ale_ruby_standardrb_executable = 'path to/bundle'
|
||||
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
|
||||
\ . ' exec standardrb'
|
||||
\ . ' --format json --force-exclusion --stdin '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.rb'))
|
||||
\ . ' --format json --force-exclusion --stdin %s'
|
||||
|
||||
@@ -11,7 +11,7 @@ After:
|
||||
|
||||
Execute(The staticcheck callback should return the right defaults):
|
||||
AssertLinter 'staticcheck',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'staticcheck '
|
||||
\ . ale#Escape(expand('%' . ':t'))
|
||||
|
||||
@@ -19,7 +19,7 @@ Execute(The staticcheck callback should use configured options):
|
||||
let b:ale_go_staticcheck_options = '-test'
|
||||
|
||||
AssertLinter 'staticcheck',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'staticcheck '
|
||||
\ . '-test ' . ale#Escape(expand('%' . ':t'))
|
||||
|
||||
@@ -27,13 +27,14 @@ Execute(The staticcheck `lint_package` option should use the correct command):
|
||||
let b:ale_go_staticcheck_lint_package = 1
|
||||
|
||||
AssertLinter 'staticcheck',
|
||||
\ ale#path#CdString(expand('%:p:h')) . 'staticcheck .',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'staticcheck .',
|
||||
|
||||
Execute(The staticcheck callback should use the `GO111MODULE` option if set):
|
||||
let b:ale_go_go111module = 'off'
|
||||
|
||||
AssertLinter 'staticcheck',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Env('GO111MODULE', 'off')
|
||||
\ . 'staticcheck '
|
||||
\ . ale#Escape(expand('%' . ':t'))
|
||||
@@ -42,6 +43,6 @@ Execute(The staticcheck callback should use the `GO111MODULE` option if set):
|
||||
let b:ale_go_staticcheck_lint_package = 1
|
||||
|
||||
AssertLinter 'staticcheck',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Env('GO111MODULE', 'off')
|
||||
\ . 'staticcheck .'
|
||||
|
||||
@@ -7,14 +7,14 @@ After:
|
||||
|
||||
Execute(The default tslint command should be correct):
|
||||
AssertLinter 'tslint',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('tslint') . ' --format json %t'
|
||||
|
||||
Execute(The rules directory option should be included if set):
|
||||
let b:ale_typescript_tslint_rules_dir = '/foo/bar'
|
||||
|
||||
AssertLinter 'tslint',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('tslint') . ' --format json'
|
||||
\ . ' -r ' . ale#Escape('/foo/bar')
|
||||
\ . ' %t'
|
||||
@@ -23,5 +23,5 @@ Execute(The executable should be configurable and escaped):
|
||||
let b:ale_typescript_tslint_executable = 'foo bar'
|
||||
|
||||
AssertLinter 'foo bar',
|
||||
\ ale#path#CdString(expand('%:p:h'))
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('foo bar') . ' --format json %t'
|
||||
|
||||
@@ -12,7 +12,7 @@ After:
|
||||
|
||||
Execute(The vulture command callback should lint file directory by default):
|
||||
AssertLinter 'vulture',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('vulture') . ' .'
|
||||
|
||||
Execute(The vulture command callback should lint project root, when present):
|
||||
@@ -31,14 +31,14 @@ Execute(The vulture executable should be configurable, and escaped properly):
|
||||
let g:ale_python_vulture_executable = 'executable with spaces'
|
||||
|
||||
AssertLinter 'executable with spaces',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('executable with spaces') . ' .'
|
||||
|
||||
Execute(The vulture command callback should let you set options):
|
||||
let g:ale_python_vulture_options = '--some-option'
|
||||
|
||||
AssertLinter 'vulture',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('vulture') . ' --some-option .'
|
||||
|
||||
Execute(The vulture command callback should detect virtualenv directories and switch to the project root):
|
||||
@@ -64,5 +64,5 @@ Execute(Setting executable to 'pipenv' appends 'run vulture'):
|
||||
let g:ale_python_vulture_executable = 'path/to/pipenv'
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ ale#path#CdString(expand('#' . bufnr('') . ':p:h'))
|
||||
\ . ale#Escape('path/to/pipenv') . ' run vulture' . ' .'
|
||||
|
||||
@@ -609,6 +609,7 @@ Execute(Should handle completion messages with additionalTextEdits when ale_comp
|
||||
|
||||
Execute(Should not handle completion messages with additionalTextEdits when ale_completion_autoimport is turned off):
|
||||
let g:ale_completion_autoimport = 0
|
||||
let b:ale_completion_info = {'line': 30}
|
||||
|
||||
AssertEqual
|
||||
\ [],
|
||||
@@ -645,3 +646,36 @@ Execute(Should not handle completion messages with additionalTextEdits when ale_
|
||||
\ ],
|
||||
\ },
|
||||
\ })
|
||||
|
||||
Execute(Should still handle completion messages with empty additionalTextEdits with ale_completion_autoimport turned off):
|
||||
let g:ale_completion_autoimport = 0
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'word': 'next_callback',
|
||||
\ 'menu': 'PlayTimeCallback',
|
||||
\ 'info': '',
|
||||
\ 'kind': 'v',
|
||||
\ 'icase': 1,
|
||||
\ }
|
||||
\ ],
|
||||
\ ale#completion#ParseLSPCompletions({
|
||||
\ 'id': 226,
|
||||
\ 'jsonrpc': '2.0',
|
||||
\ 'result': {
|
||||
\ 'isIncomplete': v:false,
|
||||
\ 'items': [
|
||||
\ {
|
||||
\ 'detail': 'PlayTimeCallback',
|
||||
\ 'filterText': 'next_callback',
|
||||
\ 'insertText': 'next_callback',
|
||||
\ 'insertTextFormat': 1,
|
||||
\ 'kind': 6,
|
||||
\ 'label': ' next_callback',
|
||||
\ 'sortText': '3ee19999next_callback',
|
||||
\ 'additionalTextEdits': [],
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ })
|
||||
|
||||
@@ -6,6 +6,7 @@ Before:
|
||||
Save g:ale_lint_on_save
|
||||
Save g:ale_echo_cursor
|
||||
Save g:ale_command_wrapper
|
||||
Save g:ale_filename_mappings
|
||||
|
||||
silent! cd /testplugin/test/fix
|
||||
|
||||
@@ -19,6 +20,7 @@ Before:
|
||||
let g:ale_fixers = {
|
||||
\ 'testft': [],
|
||||
\}
|
||||
let g:ale_filename_mappings = {}
|
||||
|
||||
let g:pre_success = 0
|
||||
let g:post_success = 0
|
||||
@@ -72,6 +74,10 @@ Before:
|
||||
return {'command': 'cat %t <(echo d)'}
|
||||
endfunction
|
||||
|
||||
function EchoFilename(buffer, lines) abort
|
||||
return {'command': 'echo %s'}
|
||||
endfunction
|
||||
|
||||
function RemoveLastLine(buffer, lines) abort
|
||||
return ['a', 'b']
|
||||
endfunction
|
||||
@@ -155,6 +161,7 @@ After:
|
||||
delfunction CatLineDeferred
|
||||
delfunction ReplaceWithTempFile
|
||||
delfunction CatWithTempFile
|
||||
delfunction EchoFilename
|
||||
delfunction RemoveLastLine
|
||||
delfunction RemoveLastLineOneArg
|
||||
delfunction TestCallback
|
||||
@@ -209,6 +216,25 @@ Expect(The first function should be used):
|
||||
^b
|
||||
^c
|
||||
|
||||
Execute(Should apply filename mpapings):
|
||||
" The command echos %s, and we'll map the current path so we can check
|
||||
" that ALEFix applies filename mappings, end-to-end.
|
||||
let g:ale_filename_mappings = {
|
||||
\ 'echo_filename': [
|
||||
\ [expand('%:p:h') . '/', '/some/fake/path/'],
|
||||
\ ],
|
||||
\}
|
||||
|
||||
call ale#fix#registry#Add('echo_filename', 'EchoFilename', [], 'echo filename')
|
||||
let g:ale_fixers.testft = ['echo_filename']
|
||||
ALEFix
|
||||
call ale#test#FlushJobs()
|
||||
" Remote trailing whitespace from the line.
|
||||
call setline(1, substitute(getline(1), '[ \r]\+$', '', ''))
|
||||
|
||||
Expect(The mapped filename should be printed):
|
||||
/some/fake/path/test.txt
|
||||
|
||||
Execute(ALEFix should apply simple functions in a chain):
|
||||
let g:ale_fixers.testft = ['AddCarets', 'Capitalize']
|
||||
ALEFix
|
||||
|
||||
11
test/fixers/test_dhall_fixer_callback.vader
Normal file
11
test/fixers/test_dhall_fixer_callback.vader
Normal file
@@ -0,0 +1,11 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('dhall', 'dhall')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertFixer
|
||||
\ { 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('dhall') . ' format --inplace %t'
|
||||
\ }
|
||||
@@ -4,6 +4,7 @@ Before:
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_python_isort_executable = 'xxxinvalid'
|
||||
let g:ale_python_isort_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
silent cd ..
|
||||
@@ -27,7 +28,7 @@ Execute(The isort callback should return the correct default values):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort')) . ' -',
|
||||
\ },
|
||||
\ ale#fixers#isort#Fix(bufnr(''))
|
||||
@@ -42,7 +43,7 @@ Execute(The isort callback should respect custom options):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir/foo'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/isort'))
|
||||
\ . ' --multi-line=3 --trailing-comma -',
|
||||
\ },
|
||||
|
||||
@@ -18,10 +18,8 @@ Execute(The latexindent callback should return the correct default values):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' -l -w'
|
||||
\ . ' %t',
|
||||
\ . ' -l'
|
||||
\ },
|
||||
\ ale#fixers#latexindent#Fix(bufnr(''))
|
||||
|
||||
@@ -31,10 +29,8 @@ Execute(The latexindent callback should include custom gofmt options):
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' -l -w'
|
||||
\ . ' -l'
|
||||
\ . ' ' . g:ale_tex_latexindent_options
|
||||
\ . ' %t',
|
||||
\ },
|
||||
\ ale#fixers#latexindent#Fix(bufnr(''))
|
||||
|
||||
@@ -19,8 +19,7 @@ Execute(The ocamlformat callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' --name=' . ale#Escape(bufname(bufnr('')))
|
||||
\ . ' -',
|
||||
\ . ' --name=%s -',
|
||||
\ },
|
||||
\ ale#fixers#ocamlformat#Fix(bufnr(''))
|
||||
|
||||
@@ -32,7 +31,6 @@ Execute(The ocamlformat callback should include custom ocamlformat options):
|
||||
\ {
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' ' . g:ale_ocaml_ocamlformat_options
|
||||
\ . ' --name=' . ale#Escape(bufname(bufnr('')))
|
||||
\ . ' -',
|
||||
\ . ' --name=%s -',
|
||||
\ },
|
||||
\ ale#fixers#ocamlformat#Fix(bufnr(''))
|
||||
|
||||
@@ -73,7 +73,7 @@ Execute(The new --stdin-filepath option should be used when the version is new e
|
||||
GivenCommandOutput ['4.4.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --eslint-config-path ' . ale#Escape(ale#path#Simplify(g:dir . '/eslint-test-files/react-app/.eslintrc.js'))
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
@@ -83,7 +83,7 @@ Execute(The version number should be cached):
|
||||
GivenCommandOutput ['4.4.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
@@ -91,7 +91,7 @@ Execute(The version number should be cached):
|
||||
GivenCommandOutput []
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('prettier-eslint')
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
@@ -297,6 +297,17 @@ Execute(Should set --parser for experimental language, Handlebars):
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
Execute(Changes to directory where .prettierignore is found):
|
||||
call ale#test#SetFilename('../prettier-test-files/with_prettierignore/src/testfile.js')
|
||||
|
||||
GivenCommandOutput ['1.6.0']
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#path#CdString(expand('%:p:h:h'))
|
||||
\ . ale#Escape(g:ale_javascript_prettier_executable)
|
||||
\ . ' --stdin-filepath %s --stdin',
|
||||
\ }
|
||||
|
||||
Execute(The prettier_d post-processor should permit regular JavaScript content):
|
||||
AssertEqual
|
||||
\ [
|
||||
|
||||
@@ -23,8 +23,7 @@ Execute(The rubocop callback should return the correct default values):
|
||||
\ {
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --auto-correct --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
@@ -36,8 +35,7 @@ Execute(The rubocop callback should include configuration files):
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||
\ . ' --auto-correct --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
@@ -51,8 +49,7 @@ Execute(The rubocop callback should include custom rubocop options):
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||
\ . ' --except Lint/Debugger'
|
||||
\ . ' --auto-correct --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
@@ -65,8 +62,7 @@ Execute(The rubocop callback should use auto-correct-all option when set):
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
|
||||
\ . ' --auto-correct-all --force-exclusion --stdin '
|
||||
\ . ale#Escape(expand('#' . bufnr('') . ':p')),
|
||||
\ . ' --auto-correct-all --force-exclusion --stdin %s'
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
Before:
|
||||
Save g:ale_stylelint_options
|
||||
|
||||
let g:ale_stylelint_options = ''
|
||||
|
||||
call ale#assert#SetUpFixerTest('css', 'stylelint')
|
||||
|
||||
After:
|
||||
@@ -10,7 +14,7 @@ Execute(The stylelint callback should return the correct default values):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
|
||||
\ . ' %t'
|
||||
@@ -24,7 +28,7 @@ Execute(The stylelint callback should include custom stylelint options):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#path#CdString(expand('%:p:h'))
|
||||
\ 'command': ale#path#BufferCdString(bufnr(''))
|
||||
\ . (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../eslint-test-files/react-app/node_modules/stylelint/bin/stylelint.js'))
|
||||
\ . ' %t'
|
||||
|
||||
23
test/handler/test_sqllint_handler.vader
Normal file
23
test/handler/test_sqllint_handler.vader
Normal file
@@ -0,0 +1,23 @@
|
||||
Before:
|
||||
" Load the file which defines the linter.
|
||||
runtime ale_linters/sql/sqllint.vim
|
||||
|
||||
After:
|
||||
" Unload all linters again.
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute (The output should be correct):
|
||||
|
||||
" Test that the right loclist items are parsed from the handler.
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 0,
|
||||
\ 'type': '',
|
||||
\ 'text': 'stdin:1 [ER_NO_DB_ERROR] No database selected'
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#sql#sqllint#Handle(bufnr(''), [
|
||||
\ 'stdin:1 [ER_NO_DB_ERROR] No database selected'
|
||||
\ ])
|
||||
@@ -1,8 +1,10 @@
|
||||
Before:
|
||||
Save g:ale_enabled
|
||||
Save g:ale_set_lists_synchronously
|
||||
Save g:ale_buffer_info
|
||||
Save &shell
|
||||
|
||||
let g:ale_enabled = 1
|
||||
let g:ale_buffer_info = {}
|
||||
let g:ale_set_lists_synchronously = 1
|
||||
|
||||
|
||||
@@ -92,8 +92,8 @@ Execute (All events should be set up when everything is on):
|
||||
\ 'FileType * call ale#events#FileTypeEvent( str2nr(expand(''<abuf>'')), expand(''<amatch>''))',
|
||||
\ 'InsertLeave * if ale#Var(str2nr(expand(''<abuf>'')), ''lint_on_insert_leave'') | call ale#Queue(0) | endif',
|
||||
\ 'InsertLeave if exists(''*ale#engine#Cleanup'') | call ale#cursor#EchoCursorWarning() | endif',
|
||||
\ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ ],
|
||||
\ CheckAutocmd('ALEEvents')
|
||||
|
||||
@@ -145,8 +145,8 @@ Execute (g:ale_lint_on_text_changed = 1 bind both events):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ ],
|
||||
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')
|
||||
|
||||
@@ -155,8 +155,8 @@ Execute (g:ale_lint_on_text_changed = 'always' should bind both events):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ ],
|
||||
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')
|
||||
|
||||
@@ -165,7 +165,7 @@ Execute (g:ale_lint_on_text_changed = 'normal' should bind only TextChanged):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ 'TextChanged * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChanged * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ ],
|
||||
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')
|
||||
|
||||
@@ -174,7 +174,7 @@ Execute (g:ale_lint_on_text_changed = 'insert' should bind only TextChangedI):
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ 'TextChangedI * call ale#Queue(g:ale_lint_delay)',
|
||||
\ 'TextChangedI * call ale#Queue(ale#Var(str2nr(expand(''<abuf>'')), ''lint_delay''))',
|
||||
\ ],
|
||||
\ filter(CheckAutocmd('ALEEvents'), 'v:val =~ ''^TextChanged''')
|
||||
|
||||
|
||||
@@ -5,7 +5,15 @@ Before:
|
||||
|
||||
let g:ale_c_parse_makefile = 1
|
||||
|
||||
function SplitAndParse(path_prefix, command) abort
|
||||
let l:args = ale#c#ShellSplit(a:command)
|
||||
|
||||
return ale#c#ParseCFlags(a:path_prefix, 0, l:args)
|
||||
endfunction
|
||||
|
||||
After:
|
||||
delfunction SplitAndParse
|
||||
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
@@ -18,7 +26,7 @@ Execute(The CFlags parser should be able to parse include directives):
|
||||
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c'])
|
||||
|
||||
AssertEqual
|
||||
\ '-isystem ' . '/usr/include/dir',
|
||||
\ '-isystem ' . ale#Escape('/usr/include/dir'),
|
||||
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -isystem /usr/include/dir -c file.c'])
|
||||
|
||||
Execute(ParseCFlags should ignore -c and -o):
|
||||
@@ -57,48 +65,21 @@ Execute(ParseCFlags should be able to parse flags with relative paths):
|
||||
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ SplitAndParse(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Isubdir '
|
||||
\ . '-I'. ale#path#Simplify('kernel/include')
|
||||
\ . ' -DTEST=`date +%s` -c file.c'
|
||||
\ )
|
||||
|
||||
Execute(ParseCFlags should be able to parse -Dgoal):
|
||||
AssertEqual
|
||||
\ '-Dgoal=9'
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Dgoal=9 -Isubdir '
|
||||
\ . '-I'. ale#path#Simplify('kernel/include')
|
||||
\ . ' -DTEST=`date +%s` -c file.c'
|
||||
\ )
|
||||
|
||||
Execute(ParseCFlags should ignore -T and other arguments):
|
||||
AssertEqual
|
||||
\ '-Dgoal=9'
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
||||
\ . ' ' . '--sysroot=subdir'
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir --sysroot=subdir '
|
||||
\ . '-I'. ale#path#Simplify('kernel/include')
|
||||
\ . ' -DTEST=`date +%s` -c file.c'
|
||||
\ )
|
||||
|
||||
Execute(ParseCFlags should handle paths with spaces in double quotes):
|
||||
Execute(We should handle paths with spaces in double quotes):
|
||||
AssertEqual
|
||||
\ '-Dgoal=9'
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ SplitAndParse(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
||||
\ . '-I"dir with spaces"' . ' -I'. ale#path#Simplify('kernel/include')
|
||||
@@ -112,7 +93,7 @@ Execute(ParseCFlags should handle paths with spaces in single quotes):
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ SplitAndParse(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
||||
\ . '-I''dir with spaces''' . ' -I'. ale#path#Simplify('kernel/include')
|
||||
@@ -127,7 +108,7 @@ Execute(ParseCFlags should handle paths with minuses):
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ SplitAndParse(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
||||
\ . '-I''dir with spaces''' . ' -Idir-with-dash'
|
||||
@@ -135,7 +116,7 @@ Execute(ParseCFlags should handle paths with minuses):
|
||||
\ . ' -DTEST=`date +%s` -c file.c'
|
||||
\ )
|
||||
|
||||
Execute(ParseCFlags should handle -D with minuses):
|
||||
Execute(We should handle -D with minuses):
|
||||
AssertEqual
|
||||
\ '-Dgoal=9'
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
||||
@@ -144,7 +125,7 @@ Execute(ParseCFlags should handle -D with minuses):
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
||||
\ . ' -DTEST=`date +%s`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ SplitAndParse(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
||||
\ . '-Dmacro-with-dash '
|
||||
@@ -153,7 +134,7 @@ Execute(ParseCFlags should handle -D with minuses):
|
||||
\ . ' -DTEST=`date +%s` -c file.c'
|
||||
\ )
|
||||
|
||||
Execute(ParseCFlags should handle flags at the end of the line):
|
||||
Execute(We should handle flags at the end of the line):
|
||||
AssertEqual
|
||||
\ '-Dgoal=9'
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
||||
@@ -161,7 +142,7 @@ Execute(ParseCFlags should handle flags at the end of the line):
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
|
||||
\ ale#c#ParseCFlags(
|
||||
\ SplitAndParse(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
||||
\ . '-Dmacro-with-dash '
|
||||
@@ -178,50 +159,170 @@ Execute(ParseCompileCommandsFlags should tolerate empty values):
|
||||
Execute(ParseCompileCommandsFlags should parse some basic flags):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
" We should read the absolute path filename entry, not the other ones.
|
||||
AssertEqual
|
||||
\ '-I ' . ale#path#Simplify('/usr/include/xmms2'),
|
||||
\ ale#c#ParseCompileCommandsFlags(bufnr(''), { "xmms2-mpris.c": [
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'): [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ "xmms2-mpris.c": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ ] }, {})
|
||||
\ {
|
||||
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': 'other.c',
|
||||
\ },
|
||||
\ ],
|
||||
\ "src": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should fall back to files with the same name):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
" We should prefer the basename file flags, not the base dirname flags.
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ "xmms2-mpris.c": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ {
|
||||
\ "src": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should parse flags for exact directory matches):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
" We should ues the exact directory flags, not the file basename flags.
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ "xmms2-mpris.c": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ {
|
||||
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': 'other.c',
|
||||
\ },
|
||||
\ ],
|
||||
\ "src": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should fall back to files in the same directory):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {},
|
||||
\ {
|
||||
\ "src": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should tolerate items without commands):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
AssertEqual
|
||||
\ '',
|
||||
\ ale#c#ParseCompileCommandsFlags(bufnr(''), { "xmms2-mpris.c": [
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
\ 'directory': '/foo/bar/xmms2-mpris',
|
||||
\ 'file': '/foo/bar/xmms2-mpris/src/xmms2-mpris.c',
|
||||
\ "xmms2-mpris.c": [
|
||||
\ {
|
||||
\ 'directory': '/foo/bar/xmms2-mpris',
|
||||
\ 'file': '/foo/bar/xmms2-mpris/src/xmms2-mpris.c',
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ ] }, {})
|
||||
|
||||
Execute(ParseCompileCommandsFlags should fall back to files in the same directory):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
||||
|
||||
AssertEqual
|
||||
\ '-I ' . ale#path#Simplify('/usr/include/xmms2'),
|
||||
\ ale#c#ParseCompileCommandsFlags(bufnr(''), {}, { "src": [
|
||||
\ {
|
||||
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
||||
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
||||
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
||||
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
||||
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
||||
\ },
|
||||
\ ] })
|
||||
\ {},
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should take commands from matching .c files for .h files):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.h'))
|
||||
|
||||
AssertEqual
|
||||
\ '-I /usr/include/xmms2',
|
||||
\ '-I ' . ale#Escape('/usr/include/xmms2'),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
@@ -235,15 +336,14 @@ Execute(ParseCompileCommandsFlags should take commands from matching .c files fo
|
||||
\ },
|
||||
\ ],
|
||||
\ },
|
||||
\ {
|
||||
\ },
|
||||
\ {},
|
||||
\ )
|
||||
|
||||
Execute(ParseCompileCommandsFlags should take commands from matching .cpp files for .hpp files):
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.hpp'))
|
||||
|
||||
AssertEqual
|
||||
\ '-I /usr/include/xmms2',
|
||||
\ '-I ' . ale#Escape('/usr/include/xmms2'),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
@@ -265,7 +365,7 @@ Execute(ParseCompileCommandsFlags should take commands from matching .cpp files
|
||||
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.h'))
|
||||
|
||||
AssertEqual
|
||||
\ '-I /usr/include/xmms2',
|
||||
\ '-I ' . ale#Escape('/usr/include/xmms2'),
|
||||
\ ale#c#ParseCompileCommandsFlags(
|
||||
\ bufnr(''),
|
||||
\ {
|
||||
@@ -305,43 +405,69 @@ Execute(ParseCompileCommandsFlags should not take commands from .c files for .h
|
||||
\ },
|
||||
\ )
|
||||
|
||||
Execute(ParseCFlags should not merge flags):
|
||||
Execute(ShellSplit should not merge flags):
|
||||
AssertEqual
|
||||
\ '-Dgoal=9'
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
|
||||
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ [
|
||||
\ 'gcc',
|
||||
\ '-Dgoal=9',
|
||||
\ '-Tlinkerfile.ld',
|
||||
\ 'blabla',
|
||||
\ '-Isubdir',
|
||||
\ 'subdir/somedep1.o',
|
||||
\ 'subdir/somedep2.o',
|
||||
\ '-I''dir with spaces''',
|
||||
\ '-Idir-with-dash',
|
||||
\ 'subdir/somedep3.o',
|
||||
\ 'subdir/somedep4.o',
|
||||
\ '-I' . ale#path#Simplify('kernel/include'),
|
||||
\ 'subdir/somedep5.o',
|
||||
\ 'subdir/somedep6.o',
|
||||
\ ],
|
||||
\ ale#c#ShellSplit(
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
||||
\ . 'subdir/somedep1.o ' . 'subdir/somedep2.o '
|
||||
\ . '-I''dir with spaces''' . ' -Idir-with-dash '
|
||||
\ . 'subdir/somedep3.o ' . 'subdir/somedep4.o '
|
||||
\ . ' -I'. ale#path#Simplify('kernel/include') . ' '
|
||||
\ . 'subdir/somedep5.o ' . 'subdir/somedep6.o '
|
||||
\ . 'subdir/somedep5.o ' . 'subdir/somedep6.o'
|
||||
\ )
|
||||
|
||||
Execute(ParseCFlags should handle parenthesis and quotes):
|
||||
Execute(ShellSplit should handle parenthesis and quotes):
|
||||
AssertEqual
|
||||
\ '-Dgoal=9 -Dtest1="('' '')" -Dtest2=''(` `)'' -Dtest3=`(" ")`',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ [
|
||||
\ 'gcc',
|
||||
\ '-Dgoal=9',
|
||||
\ '-Tlinkerfile.ld',
|
||||
\ 'blabla',
|
||||
\ '-Dtest1="('' '')"',
|
||||
\ 'file1.o',
|
||||
\ '-Dtest2=''(` `)''',
|
||||
\ 'file2.o',
|
||||
\ '-Dtest3=`(" ")`',
|
||||
\ 'file3.o',
|
||||
\ ] ,
|
||||
\ ale#c#ShellSplit(
|
||||
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla '
|
||||
\ . '-Dtest1="('' '')" file1.o '
|
||||
\ . '-Dtest2=''(` `)'' file2.o '
|
||||
\ . '-Dtest3=`(" ")` file3.o '
|
||||
\ . '-Dtest3=`(" ")` file3.o'
|
||||
\ )
|
||||
|
||||
Execute(CFlags we want to pass):
|
||||
Execute(We should include several important flags):
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/inc'))
|
||||
\ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/include'))
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incquote'))
|
||||
\ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incsystem'))
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/inc'))
|
||||
\ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include'))
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incquote'))
|
||||
\ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incsystem'))
|
||||
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
|
||||
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incframework'))
|
||||
\ . ' -Dmacro=value -D macro2 -Bbdir -B bdir2'
|
||||
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
|
||||
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
|
||||
\ . ' -Dmacro="value"'
|
||||
\ . ' -DGoal=9'
|
||||
\ . ' -D macro2'
|
||||
\ . ' -D macro3="value"'
|
||||
\ . ' -Bbdir'
|
||||
\ . ' -B bdir2'
|
||||
\ . ' -iprefix prefix -iwithprefix prefix2 -iwithprefixbefore prefix3'
|
||||
\ . ' -isysroot sysroot --sysroot=test --no-sysroot-suffix -imultilib multidir'
|
||||
\ . ' -Wsome-warning -std=c89 -pedantic -pedantic-errors -ansi'
|
||||
@@ -349,32 +475,175 @@ Execute(CFlags we want to pass):
|
||||
\ . ' -iplugindir=dir -march=native -w',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc'
|
||||
\ . ' -Iinc -I include -iquote incquote -isystem incsystem -idirafter incafter -iframework incframework'
|
||||
\ . ' -Dmacro=value -D macro2 -Bbdir -B bdir2'
|
||||
\ . ' -iprefix prefix -iwithprefix prefix2 -iwithprefixbefore prefix3'
|
||||
\ . ' -isysroot sysroot --sysroot=test --no-sysroot-suffix -imultilib multidir'
|
||||
\ . ' -Wsome-warning -std=c89 -pedantic -pedantic-errors -ansi'
|
||||
\ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++'
|
||||
\ . ' -iplugindir=dir -march=native -w'
|
||||
\ 0,
|
||||
\ [
|
||||
\ 'gcc',
|
||||
\ '-Iinc',
|
||||
\ '-I',
|
||||
\ 'include',
|
||||
\ '-iquote',
|
||||
\ 'incquote',
|
||||
\ '-isystem',
|
||||
\ 'incsystem',
|
||||
\ '-idirafter',
|
||||
\ 'incafter',
|
||||
\ '-iframework',
|
||||
\ 'incframework',
|
||||
\ '-include',
|
||||
\ '''foo bar''',
|
||||
\ '-Dmacro="value"',
|
||||
\ '-DGoal=9',
|
||||
\ '-D',
|
||||
\ 'macro2',
|
||||
\ '-D',
|
||||
\ 'macro3="value"',
|
||||
\ '-Bbdir',
|
||||
\ '-B',
|
||||
\ 'bdir2',
|
||||
\ '-iprefix',
|
||||
\ 'prefix',
|
||||
\ '-iwithprefix',
|
||||
\ 'prefix2',
|
||||
\ '-iwithprefixbefore',
|
||||
\ 'prefix3',
|
||||
\ '-isysroot',
|
||||
\ 'sysroot',
|
||||
\ '--sysroot=test',
|
||||
\ '--no-sysroot-suffix',
|
||||
\ '-imultilib',
|
||||
\ 'multidir',
|
||||
\ '-Wsome-warning',
|
||||
\ '-std=c89',
|
||||
\ '-pedantic',
|
||||
\ '-pedantic-errors',
|
||||
\ '-ansi',
|
||||
\ '-foption',
|
||||
\ '-O2',
|
||||
\ '-C',
|
||||
\ '-CC',
|
||||
\ '-trigraphs',
|
||||
\ '-nostdinc',
|
||||
\ '-nostdinc++',
|
||||
\ '-iplugindir=dir',
|
||||
\ '-march=native',
|
||||
\ '-w',
|
||||
\ ],
|
||||
\ )
|
||||
|
||||
Execute(CFlags we dont want to pass):
|
||||
Execute(We should quote the flags we need to quote):
|
||||
AssertEqual
|
||||
\ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/inc'))
|
||||
\ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include'))
|
||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incquote'))
|
||||
\ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incsystem'))
|
||||
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
|
||||
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
|
||||
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
|
||||
\ . ' ' . ale#Escape('-Dmacro="value"')
|
||||
\ . ' -DGoal=9'
|
||||
\ . ' -D macro2'
|
||||
\ . ' -D ' . ale#Escape('macro3="value"')
|
||||
\ . ' -Bbdir'
|
||||
\ . ' -B bdir2'
|
||||
\ . ' -iprefix prefix -iwithprefix prefix2 -iwithprefixbefore prefix3'
|
||||
\ . ' -isysroot sysroot --sysroot=test'
|
||||
\ . ' ' . ale#Escape('--sysroot="quoted"')
|
||||
\ . ' ' . ale#Escape('--sysroot=foo bar')
|
||||
\ . ' --no-sysroot-suffix -imultilib multidir'
|
||||
\ . ' -Wsome-warning -std=c89 -pedantic -pedantic-errors -ansi'
|
||||
\ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++'
|
||||
\ . ' -iplugindir=dir -march=native -w',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 1,
|
||||
\ [
|
||||
\ 'gcc',
|
||||
\ '-Iinc',
|
||||
\ '-I',
|
||||
\ 'include',
|
||||
\ '-iquote',
|
||||
\ 'incquote',
|
||||
\ '-isystem',
|
||||
\ 'incsystem',
|
||||
\ '-idirafter',
|
||||
\ 'incafter',
|
||||
\ '-iframework',
|
||||
\ 'incframework',
|
||||
\ '-include',
|
||||
\ '''foo bar''',
|
||||
\ '-Dmacro="value"',
|
||||
\ '-DGoal=9',
|
||||
\ '-D',
|
||||
\ 'macro2',
|
||||
\ '-D',
|
||||
\ 'macro3="value"',
|
||||
\ '-Bbdir',
|
||||
\ '-B',
|
||||
\ 'bdir2',
|
||||
\ '-iprefix',
|
||||
\ 'prefix',
|
||||
\ '-iwithprefix',
|
||||
\ 'prefix2',
|
||||
\ '-iwithprefixbefore',
|
||||
\ 'prefix3',
|
||||
\ '-isysroot',
|
||||
\ 'sysroot',
|
||||
\ '--sysroot=test',
|
||||
\ '--sysroot="quoted"',
|
||||
\ '--sysroot=foo bar',
|
||||
\ '--no-sysroot-suffix',
|
||||
\ '-imultilib',
|
||||
\ 'multidir',
|
||||
\ '-Wsome-warning',
|
||||
\ '-std=c89',
|
||||
\ '-pedantic',
|
||||
\ '-pedantic-errors',
|
||||
\ '-ansi',
|
||||
\ '-foption',
|
||||
\ '-O2',
|
||||
\ '-C',
|
||||
\ '-CC',
|
||||
\ '-trigraphs',
|
||||
\ '-nostdinc',
|
||||
\ '-nostdinc++',
|
||||
\ '-iplugindir=dir',
|
||||
\ '-march=native',
|
||||
\ '-w',
|
||||
\ ],
|
||||
\ )
|
||||
|
||||
Execute(We should exclude other flags that cause problems):
|
||||
AssertEqual
|
||||
\ '',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc -Wl,option -Wa,option -Wp,option filename.c somelib.a '
|
||||
\ . '-fdump-file=name -fdiagnostics-arg -fno-show-column -fstack-usage'
|
||||
\ 0,
|
||||
\ [
|
||||
\ 'gcc',
|
||||
\ '-Wl,option',
|
||||
\ '-Wa,option',
|
||||
\ '-Wp,option',
|
||||
\ '-c',
|
||||
\ 'filename.c',
|
||||
\ 'somelib.a',
|
||||
\ '-fdump-file=name',
|
||||
\ '-fdiagnostics-arg',
|
||||
\ '-fno-show-column',
|
||||
\ '-fstack-usage',
|
||||
\ '-Tlinkerfile.ld',
|
||||
\ ],
|
||||
\ )
|
||||
|
||||
Execute(Expanding @file in CFlags):
|
||||
Execute(We should expand @file in CFlags):
|
||||
AssertEqual
|
||||
\ '-DARGS1 -DARGS2 -O2',
|
||||
\ ale#c#ParseCFlags(
|
||||
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
||||
\ 'gcc'
|
||||
\ . ' -g'
|
||||
\ . ' @./args'
|
||||
\ . ' -O2',
|
||||
\ 0,
|
||||
\ [
|
||||
\ 'gcc',
|
||||
\ '-g',
|
||||
\ '@./args',
|
||||
\ '-O2',
|
||||
\ ],
|
||||
\ )
|
||||
|
||||
134
test/test_computed_lint_file_values.vader
Normal file
134
test/test_computed_lint_file_values.vader
Normal file
@@ -0,0 +1,134 @@
|
||||
Before:
|
||||
Save g:ale_enabled
|
||||
Save g:ale_run_synchronously
|
||||
Save g:ale_set_lists_synchronously
|
||||
Save g:ale_buffer_info
|
||||
|
||||
let g:ale_enabled = 1
|
||||
let g:ale_buffer_info = {}
|
||||
let g:ale_run_synchronously = 1
|
||||
let g:ale_set_lists_synchronously = 1
|
||||
|
||||
function! TestCallback(buffer, output)
|
||||
" Windows adds extra spaces to the text from echo.
|
||||
return [{
|
||||
\ 'lnum': 2,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'testlinter1',
|
||||
\}]
|
||||
endfunction
|
||||
function! TestCallback2(buffer, output)
|
||||
" Windows adds extra spaces to the text from echo.
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'testlinter2',
|
||||
\}]
|
||||
endfunction
|
||||
function! TestCallback3(buffer, output)
|
||||
" Windows adds extra spaces to the text from echo.
|
||||
return [{
|
||||
\ 'lnum': 3,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'testlinter3',
|
||||
\}]
|
||||
endfunction
|
||||
|
||||
" These two linters computer their lint_file values after running commands.
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'testlinter1',
|
||||
\ 'callback': 'TestCallback',
|
||||
\ 'executable': has('win32') ? 'cmd' : 'echo',
|
||||
\ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
|
||||
\ 'lint_file': {b -> ale#command#Run(b, 'echo', {-> 1})},
|
||||
\})
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'testlinter2',
|
||||
\ 'callback': 'TestCallback2',
|
||||
\ 'executable': has('win32') ? 'cmd' : 'echo',
|
||||
\ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
|
||||
\ 'lint_file': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 1})})},
|
||||
\})
|
||||
" This one directly computes the result.
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'testlinter3',
|
||||
\ 'callback': 'TestCallback3',
|
||||
\ 'executable': has('win32') ? 'cmd' : 'echo',
|
||||
\ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
|
||||
\ 'lint_file': {b -> 1},
|
||||
\})
|
||||
|
||||
let g:filename = tempname()
|
||||
call writefile([], g:filename)
|
||||
call ale#test#SetFilename(g:filename)
|
||||
|
||||
After:
|
||||
delfunction TestCallback
|
||||
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
|
||||
" Items and markers, etc.
|
||||
call setloclist(0, [])
|
||||
call clearmatches()
|
||||
call ale#sign#Clear()
|
||||
|
||||
if filereadable(g:filename)
|
||||
call delete(g:filename)
|
||||
endif
|
||||
|
||||
unlet g:filename
|
||||
|
||||
Given foobar(A file with some lines):
|
||||
foo
|
||||
bar
|
||||
baz
|
||||
|
||||
Execute(lint_file results where the result is eventually computed should be run):
|
||||
call ale#Queue(0, 'lint_file')
|
||||
call ale#test#FlushJobs()
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'lnum': 1,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'testlinter2',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'pattern': '',
|
||||
\ 'valid': 1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'lnum': 2,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'testlinter1',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'pattern': '',
|
||||
\ 'valid': 1,
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'lnum': 3,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 3,
|
||||
\ 'text': 'testlinter3',
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'pattern': '',
|
||||
\ 'valid': 1,
|
||||
\ },
|
||||
\ ],
|
||||
\ ale#test#GetLoclistWithoutModule()
|
||||
|
||||
Execute(Linters where lint_file eventually evaluates to 1 shouldn't be run if we don't want to run them):
|
||||
call ale#Queue(0, '')
|
||||
call ale#test#FlushJobs()
|
||||
|
||||
AssertEqual [], ale#test#GetLoclistWithoutModule()
|
||||
@@ -12,7 +12,7 @@ Before:
|
||||
call ale#linter#Define('foobar', {
|
||||
\ 'name': 'lint_file_linter',
|
||||
\ 'callback': 'LintFileCallback',
|
||||
\ 'executable': 'echo',
|
||||
\ 'executable': has('win32') ? 'cmd' : 'echo',
|
||||
\ 'command': {b -> ale#command#Run(b, 'echo', {-> ale#command#Run(b, 'echo', {-> 'foo'})})},
|
||||
\ 'read_buffer': 0,
|
||||
\})
|
||||
@@ -28,7 +28,7 @@ After:
|
||||
|
||||
Given foobar (Some imaginary filetype):
|
||||
Execute(It should be possible to compute an executable to check based on the result of commands):
|
||||
AssertLinter 'echo', 'foo'
|
||||
AssertLinter has('win32') ? 'cmd' : 'echo', 'foo'
|
||||
|
||||
ALELint
|
||||
call ale#test#FlushJobs()
|
||||
@@ -40,7 +40,7 @@ Execute(It should be possible to compute an executable to check based on the res
|
||||
Execute(It handle the deferred command failing):
|
||||
let g:ale_emulate_job_failure = 1
|
||||
|
||||
AssertLinter 'echo', 0
|
||||
AssertLinter has('win32') ? 'cmd' : 'echo', 0
|
||||
|
||||
ALELint
|
||||
call ale#test#FlushJobs()
|
||||
|
||||
62
test/test_filename_mapping.vader
Normal file
62
test/test_filename_mapping.vader
Normal file
@@ -0,0 +1,62 @@
|
||||
Before:
|
||||
Save g:ale_filename_mappings
|
||||
Save b:ale_filename_mappings
|
||||
|
||||
let g:ale_filename_mappings = {}
|
||||
unlet! b:ale_filename_mappings
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
Execute(ale#GetFilenameMappings should return the correct mappings for given linters/fixers):
|
||||
let g:ale_filename_mappings = {'a': [['foo', 'bar']], 'b': [['baz', 'foo']]}
|
||||
|
||||
AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), 'a')
|
||||
AssertEqual [['baz', 'foo']], ale#GetFilenameMappings(bufnr(''), 'b')
|
||||
AssertEqual [], ale#GetFilenameMappings(bufnr(''), 'c')
|
||||
|
||||
let b:ale_filename_mappings = {'b': [['abc', 'xyz']]}
|
||||
|
||||
AssertEqual [], ale#GetFilenameMappings(bufnr(''), 'a')
|
||||
AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), 'b')
|
||||
AssertEqual [], ale#GetFilenameMappings(bufnr(''), 'c')
|
||||
|
||||
Execute(ale#GetFilenameMappings should return Lists set for use with all tools):
|
||||
let g:ale_filename_mappings = [['foo', 'bar']]
|
||||
|
||||
AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), 'a')
|
||||
AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), '')
|
||||
AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), v:null)
|
||||
|
||||
let b:ale_filename_mappings = [['abc', 'xyz']]
|
||||
|
||||
AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), 'a')
|
||||
AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), '')
|
||||
AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), v:null)
|
||||
|
||||
Execute(ale#GetFilenameMappings should let you use * as a fallback):
|
||||
let g:ale_filename_mappings = {'a': [['foo', 'bar']], '*': [['abc', 'xyz']]}
|
||||
|
||||
AssertEqual [['foo', 'bar']], ale#GetFilenameMappings(bufnr(''), 'a')
|
||||
AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), 'b')
|
||||
AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), '')
|
||||
AssertEqual [['abc', 'xyz']], ale#GetFilenameMappings(bufnr(''), v:null)
|
||||
|
||||
Execute(ale#filename_mapping#Invert should invert filename mappings):
|
||||
AssertEqual
|
||||
\ [['b', 'a'], ['y', 'x']],
|
||||
\ ale#filename_mapping#Invert([['a', 'b'], ['x', 'y']])
|
||||
\
|
||||
Execute(ale#filename_mapping#Map return the filename as-is if there are no mappings):
|
||||
AssertEqual
|
||||
\ '/foo//bar',
|
||||
\ ale#filename_mapping#Map('/foo//bar', [['/bar', '/data/']])
|
||||
|
||||
Execute(ale#filename_mapping#Map should map filenames):
|
||||
AssertEqual
|
||||
\ '/data/bar',
|
||||
\ ale#filename_mapping#Map('/foo//bar', [
|
||||
\ ['/data/', '/baz/'],
|
||||
\ ['/foo/', '/data/'],
|
||||
\ ['/foo/', '/xyz/'],
|
||||
\ ])
|
||||
@@ -39,7 +39,7 @@ Execute(The defaults for the python filetype should be correct):
|
||||
AssertEqual [], GetLinterNames('python')
|
||||
|
||||
Execute(The defaults for the rust filetype should be correct):
|
||||
AssertEqual ['cargo'], GetLinterNames('rust')
|
||||
AssertEqual ['cargo', 'rls'], GetLinterNames('rust')
|
||||
|
||||
let g:ale_linters_explicit = 1
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ Before:
|
||||
let g:preview_called = 1
|
||||
let g:item_list = a:item_list
|
||||
let g:options = a:options
|
||||
|
||||
call ale#preview#SetLastSelection(a:item_list, a:options)
|
||||
endfunction
|
||||
|
||||
After:
|
||||
@@ -110,7 +112,16 @@ Given typescript(Some typescript file):
|
||||
bazxyzxyzxyz
|
||||
|
||||
Execute(Results should be shown for tsserver responses):
|
||||
call ale#references#SetMap({3: {}})
|
||||
" We should remember these options when we repeat the selection.
|
||||
call ale#references#SetMap(
|
||||
\ {
|
||||
\ 3: {
|
||||
\ 'ignorethis': 'x',
|
||||
\ 'open_in': 'tab',
|
||||
\ 'use_relative_paths': 1,
|
||||
\ }
|
||||
\ }
|
||||
\)
|
||||
call ale#references#HandleTSServerResponse(1, {
|
||||
\ 'command': 'references',
|
||||
\ 'request_seq': 3,
|
||||
@@ -158,8 +169,7 @@ Execute(Results should be shown for tsserver responses):
|
||||
AssertEqual {}, ale#references#GetMap()
|
||||
|
||||
" We should be able to repeat selections with ALERepeatSelection
|
||||
let g:ale_item_list = []
|
||||
|
||||
let g:item_list = []
|
||||
ALERepeatSelection
|
||||
|
||||
AssertEqual
|
||||
@@ -170,6 +180,12 @@ Execute(Results should be shown for tsserver responses):
|
||||
\ ],
|
||||
\ g:item_list
|
||||
AssertEqual {}, ale#references#GetMap()
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'open_in': 'tab',
|
||||
\ 'use_relative_paths': 1,
|
||||
\ },
|
||||
\ g:options
|
||||
|
||||
Execute(The preview window should not be opened for empty tsserver responses):
|
||||
call ale#references#SetMap({3: {}})
|
||||
|
||||
@@ -25,12 +25,12 @@ After:
|
||||
Execute(FormatCommand should do nothing to basic command strings):
|
||||
AssertEqual
|
||||
\ ['', 'awesome-linter do something', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'awesome-linter do something', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'awesome-linter do something', 0, v:null, [])
|
||||
|
||||
Execute(FormatCommand should handle %%, and ignore other percents):
|
||||
AssertEqual
|
||||
\ ['', '% %%d %%f %x %', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', '%% %%%d %%%f %x %', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', '%% %%%d %%%f %x %', 0, v:null, [])
|
||||
|
||||
Execute(FormatCommand should convert %s to the current filename):
|
||||
AssertEqual
|
||||
@@ -39,10 +39,10 @@ Execute(FormatCommand should convert %s to the current filename):
|
||||
\ 'foo ' . ale#Escape(expand('%:p')) . ' bar ' . ale#Escape(expand('%:p')),
|
||||
\ 0,
|
||||
\ ],
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'foo %s bar %s', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'foo %s bar %s', 0, v:null, [])
|
||||
|
||||
Execute(FormatCommand should convert %t to a new temporary filename):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %t', 0, v:null)
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %t', 0, v:null, [])
|
||||
|
||||
call CheckTempFile(g:result[0])
|
||||
|
||||
@@ -56,21 +56,21 @@ Execute(FormatCommand should convert %t to a new temporary filename):
|
||||
AssertEqual g:match[1], g:match[2]
|
||||
|
||||
Execute(FormatCommand should not convert %t to a new temporary filename when the input is given as v:false):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %t', 0, v:false)
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %t', 0, v:false, [])
|
||||
|
||||
AssertEqual ['', 'foo %t bar %t', 0], g:result
|
||||
|
||||
Execute(FormatCommand should signal that files are created when temporary files are needed):
|
||||
AssertEqual
|
||||
\ 1,
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'foo %t', 0, v:null)[2]
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'foo %t', 0, v:null, [])[2]
|
||||
|
||||
AssertEqual
|
||||
\ 0,
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'foo %s', 0, v:null)[2]
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', 'foo %s', 0, v:null, [])[2]
|
||||
|
||||
Execute(FormatCommand should let you combine %s and %t):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %s', 0, v:null)
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo %t bar %s', 0, v:null, [])
|
||||
|
||||
call CheckTempFile(g:result[0])
|
||||
|
||||
@@ -87,30 +87,30 @@ Execute(FormatCommand should replace %e with the escaped executable):
|
||||
if has('win32')
|
||||
AssertEqual
|
||||
\ ['', 'foo foo', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo', '%e %e', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo', '%e %e', 0, v:null, [])
|
||||
AssertEqual
|
||||
\ ['', '"foo bar"', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo bar', '%e', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo bar', '%e', 0, v:null, [])
|
||||
AssertEqual
|
||||
\ ['', '%e %e', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', '%e %e', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', '%e %e', 0, v:null, [])
|
||||
else
|
||||
AssertEqual
|
||||
\ ['', '''foo'' ''foo''', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo', '%e %e', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo', '%e %e', 0, v:null, [])
|
||||
AssertEqual
|
||||
\ ['', '''foo bar''', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo bar', '%e', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), 'foo bar', '%e', 0, v:null, [])
|
||||
AssertEqual
|
||||
\ ['', '%e %e', 0],
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', '%e %e', 0, v:null)
|
||||
\ ale#command#FormatCommand(bufnr('%'), '', '%e %e', 0, v:null, [])
|
||||
endif
|
||||
|
||||
Execute(EscapeCommandPart should escape all percent signs):
|
||||
AssertEqual '%%s %%t %%%% %%s %%t %%%%', ale#engine#EscapeCommandPart('%s %t %% %s %t %%')
|
||||
|
||||
Execute(EscapeCommandPart should pipe in temporary files appropriately):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo bar', 1, v:null)
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo bar', 1, v:null, [])
|
||||
|
||||
call CheckTempFile(g:result[0])
|
||||
|
||||
@@ -118,10 +118,57 @@ Execute(EscapeCommandPart should pipe in temporary files appropriately):
|
||||
Assert !empty(g:match), 'No match found! Result was: ' . g:result[1]
|
||||
AssertEqual ale#Escape(g:result[0]), g:match[1]
|
||||
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo bar %t', 1, v:null)
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', 'foo bar %t', 1, v:null, [])
|
||||
|
||||
call CheckTempFile(g:result[0])
|
||||
|
||||
let g:match = matchlist(g:result[1], '\v^foo bar (.*)$')
|
||||
Assert !empty(g:match), 'No match found! Result was: ' . g:result[1]
|
||||
AssertEqual ale#Escape(g:result[0]), g:match[1]
|
||||
|
||||
Execute(FormatCommand should apply filename modifiers to the current file):
|
||||
AssertEqual
|
||||
\ ale#Escape(expand('%:p:h'))
|
||||
\ . ' ' . ale#Escape('dummy.txt')
|
||||
\ . ' ' . ale#Escape(expand('%:p:h:t'))
|
||||
\ . ' ' . ale#Escape('txt')
|
||||
\ . ' ' . ale#Escape(expand('%:p:r')),
|
||||
\ ale#command#FormatCommand(bufnr(''), '', '%s:h %s:t %s:h:t %s:e %s:r', 0, v:null, [])[1]
|
||||
|
||||
Execute(FormatCommand should apply filename modifiers to the temporary file):
|
||||
let g:result = ale#command#FormatCommand(bufnr(''), '', '%t:h %t:t %t:h:t %t:e %t:r', 0, v:null, [])
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape(fnamemodify(g:result[0], ':h'))
|
||||
\ . ' ' . ale#Escape('dummy.txt')
|
||||
\ . ' ' . ale#Escape(fnamemodify(g:result[0], ':h:t'))
|
||||
\ . ' ' . ale#Escape('txt')
|
||||
\ . ' ' . ale#Escape(fnamemodify(g:result[0], ':r')),
|
||||
\ g:result[1]
|
||||
|
||||
Execute(FormatCommand should apply filename mappings the current file):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%s', 0, v:null, [
|
||||
\ [expand('%:p:h'), '/foo/bar'],
|
||||
\])
|
||||
|
||||
Assert g:result[1] =~# '/foo/bar'
|
||||
|
||||
Execute(FormatCommand should apply filename mappings to temporary files):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%t', 0, v:null, [
|
||||
\ [fnamemodify(tempname(), ':h:h'), '/foo/bar']
|
||||
\])
|
||||
|
||||
Assert g:result[1] =~# '/foo/bar'
|
||||
|
||||
Execute(FormatCommand should apply filename modifiers to mapped filenames):
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%s:h', 0, v:null, [
|
||||
\ [expand('%:p:h'), '/foo/bar'],
|
||||
\])
|
||||
|
||||
AssertEqual ale#Escape('/foo/bar'), g:result[1]
|
||||
|
||||
let g:result = ale#command#FormatCommand(bufnr('%'), '', '%t:h:h:h', 0, v:null, [
|
||||
\ [fnamemodify(tempname(), ':h:h'), '/foo/bar']
|
||||
\])
|
||||
|
||||
AssertEqual ale#Escape('/foo/bar'), g:result[1]
|
||||
|
||||
@@ -174,7 +174,7 @@ Execute(PreProcess should process the lint_file option correctly):
|
||||
\}
|
||||
|
||||
AssertThrows call ale#linter#PreProcess('testft', g:linter)
|
||||
AssertEqual '`lint_file` must be `0` or `1`', g:vader_exception
|
||||
AssertEqual '`lint_file` must be `0`, `1`, or a Function', g:vader_exception
|
||||
|
||||
let g:linter.lint_file = 0
|
||||
|
||||
@@ -185,14 +185,17 @@ Execute(PreProcess should process the lint_file option correctly):
|
||||
let g:linter.lint_file = 1
|
||||
|
||||
AssertEqual 1, ale#linter#PreProcess('testft', g:linter).lint_file
|
||||
" The default for read_buffer should change to 0 when lint_file is 1.
|
||||
AssertEqual 0, ale#linter#PreProcess('testft', g:linter).read_buffer
|
||||
" The default for read_buffer should still be 1
|
||||
AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer
|
||||
|
||||
let g:linter.read_buffer = 1
|
||||
|
||||
" We shouldn't be able to set both options to 1 at the same time.
|
||||
AssertThrows call ale#linter#PreProcess('testft', g:linter)
|
||||
AssertEqual 'Only one of `lint_file` or `read_buffer` can be `1`', g:vader_exception
|
||||
" We should be able to set `read_buffer` and `lint_file` at the same time.
|
||||
AssertEqual 1, ale#linter#PreProcess('testft', g:linter).read_buffer
|
||||
|
||||
let g:linter.lint_file = function('type')
|
||||
|
||||
Assert type(ale#linter#PreProcess('testft', g:linter).lint_file) is v:t_func
|
||||
|
||||
Execute(PreProcess should set a default value for lint_file):
|
||||
let g:linter = {
|
||||
|
||||
@@ -1,7 +1,50 @@
|
||||
Before:
|
||||
Save g:ale_filename_mappings
|
||||
|
||||
let g:ale_filename_mappings = {}
|
||||
|
||||
After:
|
||||
unlet! b:temp_name
|
||||
unlet! b:other_bufnr
|
||||
|
||||
Restore
|
||||
|
||||
|
||||
Execute(FixLocList should map filenames):
|
||||
" Paths converted back into temporary filenames shouldn't be included.
|
||||
let g:ale_filename_mappings = {
|
||||
\ 'linter2': [['/xxx/', '/data/']],
|
||||
\ 'linter1': [
|
||||
\ ['/bar/', '/data/special/'],
|
||||
\ ['/foo/', '/data/'],
|
||||
\ [
|
||||
\ ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h')) . '/',
|
||||
\ '/x-tmp/',
|
||||
\ ],
|
||||
\ ],
|
||||
\}
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ '/foo/file.txt',
|
||||
\ v:null,
|
||||
\ '/bar/file.txt',
|
||||
\ ],
|
||||
\ map(
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'linter1',
|
||||
\ 0,
|
||||
\ [
|
||||
\ {'text': 'x', 'lnum': 1, 'filename': '/data/file.txt'},
|
||||
\ {'text': 'x', 'lnum': 1, 'filename': '/x-tmp/file.txt'},
|
||||
\ {'text': 'x', 'lnum': 1, 'filename': '/data/special/file.txt'},
|
||||
\ ],
|
||||
\ ),
|
||||
\ 'get(v:val, ''filename'', v:null)',
|
||||
\ )
|
||||
|
||||
|
||||
Given foo (Some file with lines to count):
|
||||
foo12345678
|
||||
bar12345678
|
||||
@@ -37,7 +80,7 @@ Execute(FixLocList should set all the default values correctly):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -58,7 +101,7 @@ Execute(FixLocList should use the values we supply):
|
||||
\ 'nr': 42,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -87,7 +130,7 @@ Execute(FixLocList should set items with lines beyond the end to the last line):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -108,7 +151,7 @@ Execute(FixLocList should move line 0 to line 1):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -130,7 +173,7 @@ Execute(FixLocList should convert line and column numbers correctly):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -164,7 +207,7 @@ Execute(FixLocList should pass on end_col values):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -202,7 +245,7 @@ Execute(FixLocList should pass on end_lnum values):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -227,7 +270,7 @@ Execute(FixLocList should allow subtypes to be set):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -289,7 +332,7 @@ Execute(FixLocList should accept filenames):
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -327,7 +370,7 @@ Execute(FixLocList should interpret temporary filenames as being the current buf
|
||||
\ 'nr': -1,
|
||||
\ 'linter_name': 'foobar',
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr(''),
|
||||
\ 'foobar',
|
||||
@@ -352,7 +395,7 @@ Execute(The error code should be passed on):
|
||||
\ 'linter_name': 'foobar',
|
||||
\ 'code': 'some-code'
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -385,7 +428,7 @@ Execute(FixLocList should mark problems as coming from other sources if requeste
|
||||
\ 'linter_name': 'foobar',
|
||||
\ 'from_other_source': 1,
|
||||
\ },
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
@@ -407,7 +450,7 @@ Execute(character positions should be converted to byte positions):
|
||||
\ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 13, 'end_lnum': 1, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
|
||||
\ {'lnum': 1, 'bufnr': bufnr(''), 'col': 7, 'end_col': 17, 'end_lnum': 2, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
|
||||
\ {'lnum': 2, 'bufnr': bufnr(''), 'col': 17, 'linter_name': 'foobar', 'nr': -1, 'type': 'E', 'vcol': 0, 'text': 'a'},
|
||||
\],
|
||||
\ ],
|
||||
\ ale#engine#FixLocList(
|
||||
\ bufnr('%'),
|
||||
\ 'foobar',
|
||||
|
||||
@@ -23,22 +23,22 @@ Execute(React Native apps using CocoaPods should take precedence over the defaul
|
||||
call ale#test#SetFilename('swiftlint-test-files/react-native/testfile.swift')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/swiftlint-test-files/react-native/ios/Pods/SwiftLint/swiftlint'),
|
||||
\ ale_linters#swift#swiftlint#GetExecutable(bufnr(''))
|
||||
\ tolower(ale#path#Simplify(g:dir . '/swiftlint-test-files/react-native/ios/Pods/SwiftLint/swiftlint')),
|
||||
\ tolower(ale_linters#swift#swiftlint#GetExecutable(bufnr('')))
|
||||
|
||||
Execute(CocoaPods installation should take precedence over the default executable):
|
||||
call ale#test#SetFilename('swiftlint-test-files/cocoapods/testfile.swift')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/swiftlint-test-files/cocoapods/Pods/SwiftLint/swiftlint'),
|
||||
\ ale_linters#swift#swiftlint#GetExecutable(bufnr(''))
|
||||
\ tolower(ale#path#Simplify(g:dir . '/swiftlint-test-files/cocoapods/Pods/SwiftLint/swiftlint')),
|
||||
\ tolower(ale_linters#swift#swiftlint#GetExecutable(bufnr('')))
|
||||
|
||||
Execute(Top level CocoaPods installation should take precedence over React Native installation):
|
||||
call ale#test#SetFilename('swiftlint-test-files/cocoapods-and-react-native/testfile.swift')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/swiftlint-test-files/cocoapods-and-react-native/Pods/SwiftLint/swiftlint'),
|
||||
\ ale_linters#swift#swiftlint#GetExecutable(bufnr(''))
|
||||
\ tolower(ale#path#Simplify(g:dir . '/swiftlint-test-files/cocoapods-and-react-native/Pods/SwiftLint/swiftlint')),
|
||||
\ tolower(ale_linters#swift#swiftlint#GetExecutable(bufnr('')))
|
||||
|
||||
Execute(use-global should override other versions):
|
||||
let g:ale_swift_swiftlint_use_global = 1
|
||||
|
||||
@@ -16,5 +16,5 @@ Execute(BufferCdString should output the correct command string):
|
||||
call ale#test#SetFilename('foo.txt')
|
||||
|
||||
AssertEqual
|
||||
\ has('unix') ? 'cd ' . ale#Escape(g:dir) . ' && ' : 'cd /d ' . ale#Escape(g:dir) . ' && ',
|
||||
\ has('unix') ? 'cd %s:h && ' : 'cd /d %s:h && ',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
|
||||
Reference in New Issue
Block a user