mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Update Ale.
This commit is contained in:
42
sources_non_forked/ale/test/linter/test_ada_gcc.vader
Normal file
42
sources_non_forked/ale/test/linter/test_ada_gcc.vader
Normal file
@ -0,0 +1,42 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('ada', 'gcc')
|
||||
call ale#test#SetFilename('dummy.adb')
|
||||
|
||||
function! GetOutputDir(command) abort
|
||||
let l:split_command = split(a:command)
|
||||
let l:index = index(l:split_command, '-o')
|
||||
return l:split_command[l:index + 1]
|
||||
endfunction
|
||||
|
||||
let b:out_file = GetOutputDir(ale_linters#ada#gcc#GetCommand(bufnr('')))
|
||||
|
||||
After:
|
||||
delfunction GetOutputDir
|
||||
|
||||
unlet! b:out_file
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc') . ' -x ada -c -gnatc'
|
||||
\ . ' -o ' . b:out_file
|
||||
\ . ' -I %s:h'
|
||||
\ . ' -gnatwa -gnatq %t'
|
||||
|
||||
let b:ale_ada_gcc_executable = 'foo'
|
||||
|
||||
AssertLinter 'foo',
|
||||
\ ale#Escape('foo') . ' -x ada -c -gnatc'
|
||||
\ . ' -o ' . b:out_file
|
||||
\ . ' -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 %s:h'
|
||||
\ . ' --foo --bar %t'
|
17
sources_non_forked/ale/test/linter/test_adals.vader
Normal file
17
sources_non_forked/ale/test/linter/test_adals.vader
Normal file
@ -0,0 +1,17 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('ada', 'adals')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Sets adals executable):
|
||||
let g:ale_ada_adals_executable = '/path/to /Ada'
|
||||
AssertLinter '/path/to /Ada', ale#Escape('/path/to /Ada')
|
||||
|
||||
Execute(Sets adals encoding):
|
||||
let b:ale_ada_adals_encoding = 'iso-8859-1'
|
||||
AssertLSPConfig {'ada.defaultCharset': 'iso-8859-1', 'ada.projectFile': 'default.gpr'}
|
||||
|
||||
Execute(Sets adals project):
|
||||
let g:ale_ada_adals_project = 'myproject.gpr'
|
||||
AssertLSPConfig {'ada.defaultCharset': 'utf-8', 'ada.projectFile': 'myproject.gpr'}
|
34
sources_non_forked/ale/test/linter/test_alex.vader
Normal file
34
sources_non_forked/ale/test/linter/test_alex.vader
Normal file
@ -0,0 +1,34 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('tex', 'alex')
|
||||
call ale#test#SetFilename('test_file.tex')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The global executable should be used when the local one cannot be found):
|
||||
AssertLinter 'alex',
|
||||
\ ale#Escape('alex') . ' --stdin --text',
|
||||
|
||||
Execute(Should use the node_modules/.bin executable, if available):
|
||||
call ale#test#SetFilename('../test-files/alex/node-modules/test_file.tex')
|
||||
|
||||
AssertLinter ale#path#Simplify(g:dir . '/../test-files/alex/node-modules/node_modules/.bin/alex'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/alex/node-modules/node_modules/.bin/alex'))
|
||||
\ . ' --stdin --text',
|
||||
|
||||
Execute(Should use the node_modules/alex executable, if available):
|
||||
call ale#test#SetFilename('../test-files/alex/node-modules-2/test_file.tex')
|
||||
|
||||
AssertLinter ale#path#Simplify(g:dir . '/../test-files/alex/node-modules-2/node_modules/alex/cli.js'),
|
||||
\ (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/alex/node-modules-2/node_modules/alex/cli.js'))
|
||||
\ . ' --stdin --text',
|
||||
|
||||
Execute(Should let users configure a global executable and override local paths):
|
||||
call ale#test#SetFilename('../test-files/write-good/node-modules-2/test_file.tex')
|
||||
|
||||
let g:ale_alex_executable = '/path/to/custom/alex'
|
||||
let g:ale_alex_use_global = 1
|
||||
|
||||
AssertLinter '/path/to/custom/alex',
|
||||
\ ale#Escape('/path/to/custom/alex') . ' --stdin --text'
|
20
sources_non_forked/ale/test/linter/test_ameba.vader
Normal file
20
sources_non_forked/ale/test/linter/test_ameba.vader
Normal file
@ -0,0 +1,20 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('crystal', 'ameba')
|
||||
call ale#test#SetFilename('dummy.cr')
|
||||
|
||||
let g:ale_crystal_ameba_executable = 'bin/ameba'
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to bin/ameba):
|
||||
AssertLinter 'bin/ameba', ale#Escape('bin/ameba')
|
||||
\ . ' --format json '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.cr'))
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_crystal_ameba_executable = 'ameba'
|
||||
|
||||
AssertLinter 'ameba' , ale#Escape('ameba')
|
||||
\ . ' --format json '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/dummy.cr'))
|
28
sources_non_forked/ale/test/linter/test_angular.vader
Normal file
28
sources_non_forked/ale/test/linter/test_angular.vader
Normal file
@ -0,0 +1,28 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('html', 'angular')
|
||||
let g:paths = {}
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
unlet g:paths
|
||||
|
||||
Execute(The Angular LSP connection shouldn't be created outside of Angular projects):
|
||||
AssertLSPLanguage 'html'
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ''
|
||||
AssertLinterNotExecuted
|
||||
|
||||
Execute(The default command for Angular should be correct):
|
||||
call ale#test#SetFilename('../test-files/angular/test.html')
|
||||
let g:paths = {
|
||||
\ 'ngserver': ale#test#GetFilename('../test-files/angular/node_modules/@angular/language-server/bin/ngserver'),
|
||||
\ 'service': ale#test#GetFilename('../test-files/angular/node_modules/@angular/language-service'),
|
||||
\ 'typescript': ale#test#GetFilename('../test-files/angular/node_modules/typescript'),
|
||||
\}
|
||||
|
||||
AssertLSPLanguage 'html'
|
||||
AssertLSPProject ale#test#GetFilename('../test-files/angular')
|
||||
AssertLinter 'node', ale#Escape('node') . ' ' . ale#Escape(g:paths.ngserver)
|
||||
\ . ' --ngProbeLocations ' . ale#Escape(g:paths.service)
|
||||
\ . ' --tsProbeLocations ' . ale#Escape(g:paths.typescript)
|
||||
\ . ' --stdio'
|
26
sources_non_forked/ale/test/linter/test_ansible_lint.vader
Normal file
26
sources_non_forked/ale/test/linter/test_ansible_lint.vader
Normal file
@ -0,0 +1,26 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('ansible', 'ansible_lint')
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
After:
|
||||
unlet! b:bin_dir
|
||||
unlet! b:executable
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The ansible_lint version <5.0.0 command callback should return default string):
|
||||
GivenCommandOutput ['v4.1.2']
|
||||
AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor -p %t'
|
||||
|
||||
Execute(The ansible_lint version >=5.0.0 command callback should return default string):
|
||||
GivenCommandOutput ['v5.1.2']
|
||||
AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor --parseable-severity -x yaml %s'
|
||||
|
||||
Execute(The ansible_lint version >=6.0.0 command callback should return default string):
|
||||
GivenCommandOutput ['v6.0.2']
|
||||
AssertLinter 'ansible-lint', ale#Escape('ansible-lint') . ' --nocolor -f json -x yaml %s'
|
||||
|
||||
Execute(The ansible_lint executable should be configurable):
|
||||
let g:ale_ansible_ansible_lint_executable = '~/.local/bin/ansible-lint'
|
||||
GivenCommandOutput ['v4.1.2']
|
||||
AssertLinter '~/.local/bin/ansible-lint',
|
||||
\ ale#Escape('~/.local/bin/ansible-lint') . ' --nocolor -p %t'
|
@ -0,0 +1,65 @@
|
||||
" Author: januswel, w0rp
|
||||
|
||||
Before:
|
||||
" This is just one language for the linter.
|
||||
call ale#assert#SetUpLinterTest('asciidoc', 'textlint')
|
||||
|
||||
" The configuration is shared between many languages.
|
||||
Save g:ale_textlint_executable
|
||||
Save g:ale_textlint_use_global
|
||||
Save g:ale_textlint_options
|
||||
|
||||
let g:ale_textlint_executable = 'textlint'
|
||||
let g:ale_textlint_use_global = 0
|
||||
let g:ale_textlint_options = ''
|
||||
|
||||
unlet! b:ale_textlint_executable
|
||||
unlet! b:ale_textlint_use_global
|
||||
unlet! b:ale_textlint_options
|
||||
|
||||
After:
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_textlint_executable
|
||||
unlet! b:ale_textlint_use_global
|
||||
unlet! b:ale_textlint_options
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'textlint',
|
||||
\ ale#Escape('textlint') . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_textlint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_textlint_options = '--something'
|
||||
|
||||
AssertLinter 'textlint',
|
||||
\ ale#Escape('textlint') . ' --something -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The local executable from .bin should be used if available):
|
||||
call ale#test#SetFilename('../test-files/textlint/with_bin_path/foo.txt')
|
||||
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_bin_path/node_modules/.bin/textlint'))
|
||||
\ . ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
Execute(The local executable from textlint/bin should be used if available):
|
||||
call ale#test#SetFilename('../test-files/textlint/with_textlint_bin_path/foo.txt')
|
||||
|
||||
if has('win32')
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
||||
\ ale#Escape('node.exe') . ' ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
||||
\ . ' -f json --stdin --stdin-filename %s'
|
||||
else
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/textlint/with_textlint_bin_path/node_modules/textlint/bin/textlint.js'))
|
||||
\ . ' -f json --stdin --stdin-filename %s'
|
||||
endif
|
19
sources_non_forked/ale/test/linter/test_asm_gcc.vader
Normal file
19
sources_non_forked/ale/test/linter/test_asm_gcc.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('asm', 'gcc')
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
let b:command_tail = ' -x assembler'
|
||||
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . '-iquote %s:h'
|
||||
\ . ' -Wall -'
|
||||
|
||||
After:
|
||||
unlet! b:command_tail
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
|
||||
|
||||
let b:ale_asm_gcc_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
29
sources_non_forked/ale/test/linter/test_avra_avra.vader
Normal file
29
sources_non_forked/ale/test/linter/test_avra_avra.vader
Normal file
@ -0,0 +1,29 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('avra', 'avra')
|
||||
|
||||
let b:command_tail = ' %t -o ' . g:ale#util#nul_file
|
||||
let b:command_tail_opt = ' %t --max_errors 20 -o ' . g:ale#util#nul_file
|
||||
|
||||
After:
|
||||
unlet! b:command_tail
|
||||
unlet! b:command_tail_opt
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'avra', ale#Escape('avra') . b:command_tail,
|
||||
|
||||
let b:ale_avra_avra_executable = '~/avra'
|
||||
|
||||
AssertLinter '~/avra', ale#Escape('~/avra') . b:command_tail
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_avra_avra_options = '--max_errors 20'
|
||||
|
||||
AssertLinter 'avra', ale#Escape('avra')
|
||||
\ . ' %t --max_errors 20 -o ' . g:ale#util#nul_file
|
||||
|
||||
Execute(The options should be used in command):
|
||||
let b:ale_avra_avra_options = '--max_errors 20'
|
||||
|
||||
AssertLinter 'avra', ale#Escape('avra') . b:command_tail_opt
|
90
sources_non_forked/ale/test/linter/test_bandit.vader
Normal file
90
sources_non_forked/ale/test/linter/test_bandit.vader
Normal file
@ -0,0 +1,90 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('python', 'bandit')
|
||||
let b:bandit_flags = ' --format custom '
|
||||
\ . '--msg-template "{line}:{test_id}:{severity}:{msg}" '
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
unlet! b:bandit_flags
|
||||
|
||||
Execute(The bandit command callback should return default string):
|
||||
AssertLinter 'bandit',
|
||||
\ ale#Escape('bandit')
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(The bandit command callback should allow options):
|
||||
let g:ale_python_bandit_options = '--configfile bandit.yaml'
|
||||
|
||||
AssertLinter 'bandit',
|
||||
\ ale#Escape('bandit')
|
||||
\ . b:bandit_flags
|
||||
\ . ' --configfile bandit.yaml -'
|
||||
|
||||
Execute(The bandit executable should be configurable):
|
||||
let g:ale_python_bandit_executable = '~/.local/bin/bandit'
|
||||
|
||||
AssertLinter '~/.local/bin/bandit',
|
||||
\ ale#Escape('~/.local/bin/bandit')
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(Setting executable to 'pipenv' appends 'run bandit'):
|
||||
let g:ale_python_bandit_executable = 'path/to/pipenv'
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#Escape('path/to/pipenv')
|
||||
\ . ' run bandit'
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(Pipenv is detected when python_bandit_auto_pipenv is set):
|
||||
let g:ale_python_bandit_auto_pipenv = 1
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#Escape('pipenv')
|
||||
\ . ' run bandit'
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(Setting executable to 'poetry' appends 'run bandit'):
|
||||
let g:ale_python_bandit_executable = 'path/to/poetry'
|
||||
|
||||
AssertLinter 'path/to/poetry',
|
||||
\ ale#Escape('path/to/poetry')
|
||||
\ . ' run bandit'
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(Poetry is detected when python_bandit_auto_poetry is set):
|
||||
let g:ale_python_bandit_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry')
|
||||
\ . ' run bandit'
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(The bandit command callback should add .bandit by default):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/namespace/foo/bar.py')
|
||||
|
||||
let b:config_path = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_bandit/.bandit'
|
||||
\)
|
||||
|
||||
AssertLinter 'bandit',
|
||||
\ ale#Escape('bandit')
|
||||
\ . ' --ini ' . ale#Escape(b:config_path)
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
||||
|
||||
Execute(The bandit command callback should support not using .bandit):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/../test-files/python/with_bandit/subdir/foo/bar.py')
|
||||
let g:ale_python_bandit_use_config = 0
|
||||
|
||||
AssertLinter 'bandit',
|
||||
\ ale#Escape('bandit')
|
||||
\ . b:bandit_flags
|
||||
\ . ' -'
|
15
sources_non_forked/ale/test/linter/test_bashate.vader
Normal file
15
sources_non_forked/ale/test/linter/test_bashate.vader
Normal file
@ -0,0 +1,15 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('sh', 'bashate')
|
||||
call ale#test#SetFilename('test.sh')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default bashate command should be correct):
|
||||
AssertLinter 'bashate', ale#Escape('bashate') . ' %t'
|
||||
|
||||
Execute(The bashate command should accept options):
|
||||
let b:ale_sh_bashate_options = '-i E310 --max-line-length 100'
|
||||
|
||||
AssertLinter 'bashate',
|
||||
\ ale#Escape('bashate') . ' -i E310 --max-line-length 100 %t'
|
24
sources_non_forked/ale/test/linter/test_bib_bibclean.vader
Normal file
24
sources_non_forked/ale/test/linter/test_bib_bibclean.vader
Normal file
@ -0,0 +1,24 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('bib', 'bibclean')
|
||||
|
||||
let g:ale_ruby_rubocop_executable = 'bibclean'
|
||||
let g:ale_ruby_rubocop_options = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to bibclean):
|
||||
AssertLinter 'bibclean', ale#Escape('bibclean')
|
||||
\ . ' -file-position '
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_bib_bibclean_executable = 'bin/bibclean'
|
||||
|
||||
AssertLinter 'bin/bibclean' , ale#Escape('bin/bibclean')
|
||||
\ . ' -file-position '
|
||||
|
||||
Execute(Should not include custom options):
|
||||
let g:ale_bib_bibclean_options = '-no-prettryprint'
|
||||
|
||||
AssertLinter 'bibclean' , ale#Escape('bibclean')
|
||||
\ . ' -file-position '
|
74
sources_non_forked/ale/test/linter/test_bingo.vader
Normal file
74
sources_non_forked/ale/test/linter/test_bingo.vader
Normal file
@ -0,0 +1,74 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'bingo')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
if isdirectory(g:dir . '/.git')
|
||||
call delete(g:dir . '/.git', 'd')
|
||||
endif
|
||||
|
||||
unlet! b:ale_completion_enabled
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(should set correct defaults):
|
||||
AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio'
|
||||
|
||||
Execute(should configure bingo callback executable):
|
||||
let b:ale_go_bingo_executable = 'boo'
|
||||
let b:ale_go_bingo_options = ''
|
||||
|
||||
AssertLinter 'boo', ale#Escape('boo')
|
||||
|
||||
Execute(should set bingo options):
|
||||
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
||||
" let b:ale_completion_enabled = 1
|
||||
let b:ale_go_bingo_options = ''
|
||||
|
||||
AssertLinter 'bingo',
|
||||
\ ale#Escape('bingo') . ''
|
||||
|
||||
let b:ale_go_bingo_options = '--mode stdio --trace'
|
||||
|
||||
AssertLinter 'bingo',
|
||||
\ ale#Escape('bingo') . ' --mode stdio --trace'
|
||||
|
||||
Execute(should support Go environment variables):
|
||||
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'bingo',
|
||||
\ ale#Env('GO111MODULE', 'on') . ale#Escape('bingo') . ' --mode stdio'
|
||||
|
||||
|
||||
Execute(Should return directory for 'go.mod' if found in parent directory):
|
||||
call ale#test#SetFilename('../test-files/go/test.go')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go')
|
||||
|
||||
Execute(Should return nearest directory with '.git' if found in parent directory):
|
||||
call ale#test#SetFilename('test.go')
|
||||
call mkdir(g:dir . '/.git')
|
||||
|
||||
AssertLSPProject g:dir
|
||||
|
||||
Execute(Should ignore 'go.mod' and return '.git' dir if modules off):
|
||||
call ale#test#SetFilename('../test-files/go/test.go')
|
||||
|
||||
let b:ale_go_go111module = 'off'
|
||||
let b:parent_dir = ale#path#Simplify(g:dir . '/..')
|
||||
let b:git_dir = b:parent_dir . '/.git'
|
||||
|
||||
if !isdirectory(b:git_dir)
|
||||
call mkdir(b:git_dir)
|
||||
endif
|
||||
|
||||
AssertLSPProject b:parent_dir
|
||||
|
||||
call delete(b:git_dir, 'd')
|
||||
unlet! b:parent_dir
|
||||
unlet! b:git_dir
|
13
sources_non_forked/ale/test/linter/test_bitbake.vader
Executable file
13
sources_non_forked/ale/test/linter/test_bitbake.vader
Executable file
@ -0,0 +1,13 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('bitbake', 'oelint_adv')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'oelint-adv', ale#Escape('oelint-adv') . ' --quiet %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_bitbake_oelint_adv_executable = 'xyz'
|
||||
|
||||
AssertLinter 'xyz', ale#Escape('xyz') . ' --quiet %s'
|
37
sources_non_forked/ale/test/linter/test_brakeman.vader
Normal file
37
sources_non_forked/ale/test/linter/test_brakeman.vader
Normal file
@ -0,0 +1,37 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('ruby', 'brakeman')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The brakeman command callback should detect absence of a valid Rails app):
|
||||
call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/test.rb')
|
||||
|
||||
AssertLinter 'brakeman', ''
|
||||
|
||||
Execute(The brakeman command callback should find a valid Rails app root):
|
||||
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb')
|
||||
|
||||
AssertLinter 'brakeman', ale#Escape('brakeman')
|
||||
\ . ' -f json -q -p '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app'))
|
||||
|
||||
Execute(The brakeman command callback should include configured options):
|
||||
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb')
|
||||
|
||||
let g:ale_ruby_brakeman_options = '--combobulate'
|
||||
|
||||
AssertLinter 'brakeman', ale#Escape('brakeman')
|
||||
\ . ' -f json -q --combobulate -p '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app'))
|
||||
|
||||
Execute(Setting bundle appends 'exec brakeman'):
|
||||
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/db/test.rb')
|
||||
|
||||
let g:ale_ruby_brakeman_executable = 'bundle'
|
||||
let g:ale_ruby_brakeman_options = '--combobulate'
|
||||
|
||||
AssertLinter 'bundle', ale#Escape('bundle')
|
||||
\ . ' exec brakeman'
|
||||
\ . ' -f json -q --combobulate -p '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/ruby/valid_rails_app'))
|
22
sources_non_forked/ale/test/linter/test_buf_lint.vader
Normal file
22
sources_non_forked/ale/test/linter/test_buf_lint.vader
Normal file
@ -0,0 +1,22 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('proto', 'buf_lint')
|
||||
call ale#test#SetFilename('test.proto')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'buf',
|
||||
\ ale#Escape('buf')
|
||||
\ . ' lint'
|
||||
\ . ' %s#include_package_files=true'
|
||||
|
||||
Execute(The callback should include any additional options):
|
||||
let b:ale_proto_buf_lint_executable = '/tmp/buf'
|
||||
let b:ale_proto_buf_lint_config = '/tmp/buf.yaml'
|
||||
|
||||
AssertLinter '/tmp/buf',
|
||||
\ ale#Escape('/tmp/buf')
|
||||
\ . ' lint'
|
||||
\ . ' --config=' . ale#Escape('/tmp/buf.yaml')
|
||||
\ . ' %s#include_package_files=true'
|
55
sources_non_forked/ale/test/linter/test_c_cc.vader
Normal file
55
sources_non_forked/ale/test/linter/test_c_cc.vader
Normal file
@ -0,0 +1,55 @@
|
||||
Before:
|
||||
Save g:ale_c_parse_makefile
|
||||
Save g:ale_history_enabled
|
||||
|
||||
let g:ale_c_parse_makefile = 0
|
||||
let g:ale_history_enabled = 0
|
||||
|
||||
let g:get_cflags_return_value = ''
|
||||
let g:executable_map = {}
|
||||
|
||||
runtime autoload/ale/c.vim
|
||||
runtime autoload/ale/engine.vim
|
||||
|
||||
function! ale#engine#IsExecutable(buffer, executable) abort
|
||||
return has_key(g:executable_map, a:executable)
|
||||
endfunction
|
||||
|
||||
function! ale#c#GetCFlags(buffer, output) abort
|
||||
return g:get_cflags_return_value
|
||||
endfunction
|
||||
|
||||
call ale#assert#SetUpLinterTest('c', 'cc')
|
||||
|
||||
let b:command_tail = ' -S -x c'
|
||||
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -std=c11 -Wall -'
|
||||
|
||||
After:
|
||||
unlet! g:get_cflags_return_value
|
||||
unlet! g:executable_map
|
||||
unlet! b:command_tail
|
||||
|
||||
runtime autoload/ale/c.vim
|
||||
runtime autoload/ale/engine.vim
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(clang should be used instead of gcc, if available):
|
||||
let g:executable_map = {'clang': 1}
|
||||
|
||||
AssertLinter 'clang', [ale#Escape('clang') . b:command_tail]
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
|
||||
|
||||
let b:ale_c_cc_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
|
||||
|
||||
Execute(The -std flag should be replaced by parsed C flags):
|
||||
let b:command_tail = substitute(b:command_tail, 'c11', 'c99 ', '')
|
||||
let g:get_cflags_return_value = '-std=c99'
|
||||
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
|
69
sources_non_forked/ale/test/linter/test_c_ccls.vader
Normal file
69
sources_non_forked/ale/test/linter/test_c_ccls.vader
Normal file
@ -0,0 +1,69 @@
|
||||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>
|
||||
" Description: A language server for C
|
||||
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('c', 'ccls')
|
||||
|
||||
Save b:ale_c_build_dir_names
|
||||
Save b:ale_c_ccls_executable
|
||||
Save b:ale_c_ccls_init_options
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The project root should be detected correctly using compile_commands.json file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.c')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json')
|
||||
|
||||
Execute(The project root should be detected correctly using .ccls file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.c')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls')
|
||||
|
||||
Execute(The project root should be detected correctly using .ccls-root file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.c')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_ccls-root/dummy.c')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls-root')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'ccls', ale#Escape('ccls')
|
||||
|
||||
let b:ale_c_ccls_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
|
||||
Execute(The initialization options should be configurable):
|
||||
AssertLSPOptions {}
|
||||
|
||||
let b:ale_c_ccls_init_options = { 'cacheDirectory': '/tmp/ccls' }
|
||||
|
||||
AssertLSPOptions { 'cacheDirectory': '/tmp/ccls' }
|
||||
|
||||
Execute(The compile command database should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c')
|
||||
|
||||
AssertLSPOptions {}
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c')
|
||||
|
||||
AssertLSPOptions { 'compilationDatabaseDirectory':
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') }
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_build_dir/dummy.c')
|
||||
let b:ale_c_build_dir_names = ['unusual_build_dir_name']
|
||||
|
||||
AssertLSPOptions { 'compilationDatabaseDirectory':
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/ccls/with_build_dir/unusual_build_dir_name') }
|
77
sources_non_forked/ale/test/linter/test_c_clang_tidy.vader
Normal file
77
sources_non_forked/ale/test/linter/test_c_clang_tidy.vader
Normal file
@ -0,0 +1,77 @@
|
||||
Before:
|
||||
Save g:ale_c_parse_makefile
|
||||
let g:ale_c_parse_makefile = 0
|
||||
|
||||
call ale#assert#SetUpLinterTest('c', 'clangtidy')
|
||||
call ale#test#SetFilename('test.c')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The clangtidy command default should be correct):
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' %s'
|
||||
|
||||
Execute(You should be able to remove the -checks option for clang-tidy):
|
||||
let b:ale_c_clangtidy_checks = []
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' %s'
|
||||
|
||||
Execute(You should be able to set other checks for clang-tidy):
|
||||
let b:ale_c_clangtidy_checks = ['-*', 'clang-analyzer-*']
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
|
||||
|
||||
Execute(You should be able to manually set compiler flags for clang-tidy):
|
||||
let b:ale_c_clangtidy_checks = ['*']
|
||||
let b:ale_c_clangtidy_options = '-Wall'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
|
||||
Execute(You should be able to manually set flags for clang-tidy):
|
||||
let b:ale_c_clangtidy_extra_options = '-config='
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' ' . ale#Escape('-config=') . ' %s'
|
||||
|
||||
Execute(The build directory should be configurable):
|
||||
let b:ale_c_clangtidy_checks = ['*']
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory setting should override the options):
|
||||
let b:ale_c_clangtidy_checks = ['*']
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_c_clangtidy_options = '-Wall'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory should be used for header files):
|
||||
call ale#test#SetFilename('test.h')
|
||||
|
||||
let b:ale_c_clangtidy_checks = ['*']
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_c_clangtidy_options = '-Wall'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_c_clangtidy_checks = ['*']
|
||||
let b:ale_c_clangtidy_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s'
|
47
sources_non_forked/ale/test/linter/test_c_clangd.vader
Normal file
47
sources_non_forked/ale/test/linter/test_c_clangd.vader
Normal file
@ -0,0 +1,47 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('c', 'clangd')
|
||||
|
||||
Save b:ale_c_clangd_options
|
||||
Save b:ale_c_build_dir
|
||||
Save b:ale_c_build_dir_names
|
||||
Save b:ale_c_parse_compile_commands
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The language string should be correct):
|
||||
AssertLSPLanguage 'c'
|
||||
|
||||
Execute(The default executable should be correct):
|
||||
AssertLinter 'clangd', ale#Escape('clangd')
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.c')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/clangd/with_compile_commands/dummy.c')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/clangd/with_compile_commands')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_c_clangd_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_c_clangd_options = '-compile-commands-dir=foo'
|
||||
|
||||
AssertLinter 'clangd', ale#Escape('clangd') . ' ' . b:ale_c_clangd_options
|
||||
|
||||
Execute(The compile command database should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/clangd/with_build_dir/dummy_src/dummy.c')
|
||||
|
||||
let b:ale_c_clangd_options = ''
|
||||
let b:ale_c_build_dir = ''
|
||||
let b:ale_c_build_dir_names = ['unusual_build_dir_name']
|
||||
let b:ale_c_parse_compile_commands = 1
|
||||
|
||||
AssertLinter 'clangd', ale#Escape('clangd')
|
||||
\ . ' -compile-commands-dir='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/clangd/with_build_dir/unusual_build_dir_name'))
|
63
sources_non_forked/ale/test/linter/test_c_cppcheck.vader
Normal file
63
sources_non_forked/ale/test/linter/test_c_cppcheck.vader
Normal file
@ -0,0 +1,63 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('c', 'cppcheck')
|
||||
let b:command_tail = ' -q --language=c --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') . ' --enable=style -I' . ale#Escape(ale#path#Simplify(g:dir)) .' %t'
|
||||
|
||||
After:
|
||||
unlet! b:rel_file_path
|
||||
unlet! b:command_tail
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail
|
||||
|
||||
let b:ale_c_cppcheck_executable = 'foobar'
|
||||
|
||||
AssertLinterCwd ''
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
||||
Execute(cppcheck for C should detect compile_commands.json files):
|
||||
let b:rel_file_path = '../test-files/cppcheck/one/foo.c'
|
||||
call ale#test#SetFilename(b:rel_file_path)
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' --project=' . ale#Escape('compile_commands.json')
|
||||
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
|
||||
\ . ' --enable=style %t'
|
||||
|
||||
Execute(cppcheck for C should detect compile_commands.json files in build directories):
|
||||
let b:rel_file_path = '../test-files/cppcheck/with_build_dir/foo.c'
|
||||
call ale#test#SetFilename(b:rel_file_path)
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/with_build_dir')
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
|
||||
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
|
||||
\ . ' --enable=style %t'
|
||||
|
||||
Execute(cppcheck for C should include file dir if compile_commands.json file is not found):
|
||||
call ale#test#SetFilename('../test-files/cppcheck/foo.c')
|
||||
|
||||
AssertLinter 'cppcheck',
|
||||
\ ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' --enable=style'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck'))
|
||||
\ . ' %t'
|
||||
|
||||
Execute(cppcheck for C header should include file dir and not use compile_commands.json):
|
||||
call ale#test#SetFilename('../test-files/cppcheck/one/foo.h')
|
||||
|
||||
AssertLinter 'cppcheck',
|
||||
\ ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one'))
|
||||
\ . ' --suppress=unusedStructMember'
|
||||
\ . ' --enable=style'
|
||||
\ . ' %t'
|
37
sources_non_forked/ale/test/linter/test_c_cquery.vader
Normal file
37
sources_non_forked/ale/test/linter/test_c_cquery.vader
Normal file
@ -0,0 +1,37 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('c', 'cquery')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The project root should be detected correctly using compile_commands.json file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.c')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/cquery/dummy.c')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery')
|
||||
|
||||
Execute(The project root should be detected correctly using .cquery file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.c')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/cquery/with_cquery/dummy.c')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery/with_cquery')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'cquery', ale#Escape('cquery')
|
||||
|
||||
let b:ale_c_cquery_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
|
||||
Execute(The cache directory should be configurable):
|
||||
AssertLSPOptions {'cacheDirectory': expand('$HOME/.cache/cquery')}
|
||||
|
||||
let b:ale_c_cquery_cache_directory = '/foo/bar'
|
||||
|
||||
AssertLSPOptions {'cacheDirectory': '/foo/bar'}
|
24
sources_non_forked/ale/test/linter/test_c_flawfinder.vader
Normal file
24
sources_non_forked/ale/test/linter/test_c_flawfinder.vader
Normal file
@ -0,0 +1,24 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('c', 'flawfinder')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The flawfinder command should be correct):
|
||||
AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t'
|
||||
|
||||
Execute(The minlevel of flawfinder should be configurable):
|
||||
let b:ale_c_flawfinder_minlevel = 8
|
||||
|
||||
AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t'
|
||||
|
||||
Execute(Additional flawfinder options should be configurable):
|
||||
let b:ale_c_flawfinder_options = '--foobar'
|
||||
|
||||
AssertLinter 'flawfinder',
|
||||
\ ale#Escape('flawfinder') . ' -CDQS --foobar --minlevel=1 %t'
|
||||
|
||||
Execute(The flawfinder exectable should be configurable):
|
||||
let b:ale_c_flawfinder_executable = 'foo/bar'
|
||||
|
||||
AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t'
|
162
sources_non_forked/ale/test/linter/test_c_import_paths.vader
Normal file
162
sources_non_forked/ale/test/linter/test_c_import_paths.vader
Normal file
@ -0,0 +1,162 @@
|
||||
Before:
|
||||
" Make sure the c.vim file is loaded first.
|
||||
call ale#c#FindProjectRoot(bufnr(''))
|
||||
|
||||
Save g:ale_c_parse_compile_commands
|
||||
Save g:ale_c_parse_makefile
|
||||
Save g:__ale_c_project_filenames
|
||||
|
||||
let g:original_project_filenames = g:__ale_c_project_filenames
|
||||
let g:executable_map = {}
|
||||
|
||||
" Remove the .git/HEAD dir for C import paths for these tests.
|
||||
" The tests run inside of a git repo.
|
||||
let g:__ale_c_project_filenames = filter(
|
||||
\ copy(g:__ale_c_project_filenames),
|
||||
\ 'v:val isnot# ''.git/HEAD'''
|
||||
\)
|
||||
|
||||
let g:ale_c_parse_compile_commands = 0
|
||||
let g:ale_c_parse_makefile = 0
|
||||
|
||||
runtime autoload/ale/engine.vim
|
||||
|
||||
function! ale#engine#IsExecutable(buffer, executable) abort
|
||||
return has_key(g:executable_map, a:executable)
|
||||
endfunction
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:original_project_filenames
|
||||
unlet! g:executable_map
|
||||
|
||||
runtime autoload/ale/engine.vim
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The C cc linter should include 'include' directories for projects with a Makefile):
|
||||
call ale#assert#SetUpLinterTest('c', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.c')
|
||||
let g:ale_c_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C cc linter should include 'include' directories for projects with a configure file):
|
||||
call ale#assert#SetUpLinterTest('c', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/configure_project/subdir/file.c')
|
||||
let g:ale_c_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/configure_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C cc linter should include root directories for projects with .h files in them):
|
||||
call ale#assert#SetUpLinterTest('c', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/h_file_project/subdir/file.c')
|
||||
let g:ale_c_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/h_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C cc linter should include root directories for projects with .hpp files in them):
|
||||
call ale#assert#SetUpLinterTest('c', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/hpp_file_project/subdir/file.c')
|
||||
let g:ale_c_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/hpp_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C ClangTidy handler should include 'include' directories for projects with a Makefile):
|
||||
call ale#assert#SetUpLinterTest('c', 'clangtidy')
|
||||
call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp')
|
||||
let g:ale_c_clangtidy_options = ''
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' %s '
|
||||
\ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include'))
|
||||
|
||||
Execute(The C++ cc linter should include 'include' directories for projects with a Makefile):
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp')
|
||||
let g:ale_cpp_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C++ cc linter should include 'include' directories for projects with a configure file):
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/configure_project/subdir/file.cpp')
|
||||
let g:ale_cpp_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/configure_project/include'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C++ cc linter should include root directories for projects with .h files in them):
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/h_file_project/subdir/file.cpp')
|
||||
let g:ale_cpp_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/h_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C++ cc linter should include root directories for projects with .hpp files in them):
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
||||
call ale#test#SetFilename('../test-files/c/hpp_file_project/subdir/file.cpp')
|
||||
let g:ale_cpp_cc_options = ''
|
||||
|
||||
AssertLinter 'gcc',
|
||||
\ ale#Escape('gcc')
|
||||
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/hpp_file_project'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The C++ ClangTidy handler should include json folders for projects with suitable build directory in them):
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
|
||||
call ale#test#SetFilename('../test-files/c/json_project/subdir/file.cpp')
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' %s '
|
||||
\ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/json_project/build'))
|
||||
|
||||
Execute(The C++ ClangTidy handler should include 'include' directories for projects with a Makefile):
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
|
||||
call ale#test#SetFilename('../test-files/c/makefile_project/subdir/file.cpp')
|
||||
let g:ale_cpp_clangtidy_options = ''
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' %s '
|
||||
\ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/c/makefile_project/include'))
|
||||
|
222
sources_non_forked/ale/test/linter/test_cargo.vader
Normal file
222
sources_non_forked/ale/test/linter/test_cargo.vader
Normal file
@ -0,0 +1,222 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('rust', 'cargo')
|
||||
call ale#test#SetFilename('../test-files/cargo/test.rs')
|
||||
|
||||
let g:cd = 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cargo')) . ' && '
|
||||
let g:suffix = ' --frozen --message-format=json -q'
|
||||
let g:ale_rust_cargo_avoid_whole_workspace = 0
|
||||
|
||||
" Test with version 0.22.0 by default.
|
||||
GivenCommandOutput ['cargo 0.22.0 (3423351a5 2017-10-06)']
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
unlet! g:cd
|
||||
unlet! g:suffix
|
||||
|
||||
Execute(The linter should not be executed when there's no Cargo.toml file):
|
||||
call ale#test#SetFilename('../foo.rs')
|
||||
AssertLinterNotExecuted
|
||||
|
||||
Execute(The linter should be executed when there is a Cargo.toml file):
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'cargo', 'cargo build --frozen --message-format=json -q'
|
||||
|
||||
Execute(`cargo check` should be used when the version is new enough):
|
||||
GivenCommandOutput ['cargo 0.17.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo check' . g:suffix,
|
||||
\]
|
||||
|
||||
" We should cache the version check
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'cargo', ['cargo check' . g:suffix]
|
||||
|
||||
Execute(`cargo build` should be used when cargo is too old):
|
||||
GivenCommandOutput ['cargo 0.16.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo build' . g:suffix,
|
||||
\]
|
||||
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'cargo', ['cargo build' . g:suffix]
|
||||
|
||||
Execute(`cargo build` should be used when g:ale_rust_cargo_use_check is set to 0):
|
||||
let g:ale_rust_cargo_use_check = 0
|
||||
|
||||
GivenCommandOutput ['cargo 0.24.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo build' . g:suffix,
|
||||
\]
|
||||
|
||||
" We should cache the version check
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'cargo', ['cargo build' . g:suffix]
|
||||
|
||||
Execute(`cargo check` should be used when the version is new enough):
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo check' . g:suffix,
|
||||
\]
|
||||
|
||||
" We should cache the version check
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'cargo', ['cargo check' . g:suffix]
|
||||
|
||||
Execute(--all-targets should be used when g:ale_rust_cargo_check_all_targets is set to 1):
|
||||
let g:ale_rust_cargo_check_all_targets = 1
|
||||
|
||||
AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --all-targets' . g:suffix]
|
||||
" We should cache the version check
|
||||
AssertLinter 'cargo', ['cargo check --all-targets' . g:suffix]
|
||||
|
||||
Execute(--tests should be used when g:ale_rust_cargo_check_tests is set to 1):
|
||||
let g:ale_rust_cargo_check_tests = 1
|
||||
|
||||
AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --tests' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'cargo', ['cargo check --tests' . g:suffix]
|
||||
|
||||
Execute(--examples should be used when g:ale_rust_cargo_check_examples is set to 1):
|
||||
let g:ale_rust_cargo_check_examples = 1
|
||||
|
||||
AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --examples' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'cargo', ['cargo check --examples' . g:suffix]
|
||||
|
||||
Execute(--no-default-features should be used when g:ale_rust_cargo_default_feature_behavior is none):
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'none'
|
||||
|
||||
AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --no-default-features']
|
||||
|
||||
Execute(g:ale_rust_cargo_include_features added when g:ale_rust_cargo_default_feature_behavior is none):
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'none'
|
||||
let b:ale_rust_cargo_include_features = 'foo bar'
|
||||
|
||||
AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --no-default-features --features ' . ale#Escape('foo bar')]
|
||||
|
||||
Execute(g:ale_rust_cargo_include_features added and escaped):
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'default'
|
||||
let b:ale_rust_cargo_include_features = "foo bar baz"
|
||||
|
||||
AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --features ' . ale#Escape('foo bar baz')]
|
||||
|
||||
Execute(--all-features should be used when g:ale_rust_cargo_default_feature_behavior is all):
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'all'
|
||||
" When all features are enabled we should ignore extra features to add
|
||||
" since it won't do anything
|
||||
let b:ale_rust_cargo_include_features = 'foo bar'
|
||||
|
||||
GivenCommandOutput ['cargo 0.22.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter 'cargo', [ale#Escape('cargo') . ' --version', 'cargo check --frozen --message-format=json -q --all-features']
|
||||
|
||||
Execute(Cargo should run from the crate directory when set to avoid the workspace):
|
||||
let g:ale_rust_cargo_avoid_whole_workspace = 1
|
||||
call ale#test#SetFilename('../test-files/cargo/workspace_paths/subpath/test.rs')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cargo/workspace_paths/subpath')
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo check --frozen --message-format=json -q',
|
||||
\]
|
||||
|
||||
Execute(Cargo should not run from the crate directory when not set to avoid the workspace):
|
||||
let g:ale_rust_cargo_avoid_whole_workspace = 0
|
||||
call ale#test#SetFilename('../test-files/cargo/workspace_paths/subpath/test.rs')
|
||||
|
||||
AssertLinterCwd ''
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo check --frozen --message-format=json -q',
|
||||
\]
|
||||
|
||||
Execute(When ale_rust_cargo_use_clippy is set, cargo-clippy is used as linter):
|
||||
let b:ale_rust_cargo_use_clippy = 1
|
||||
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo clippy --frozen --message-format=json -q',
|
||||
\]
|
||||
|
||||
Execute(When ale_rust_cargo_clippy_options is set, cargo-clippy appends it to commandline):
|
||||
let b:ale_rust_cargo_use_clippy = 1
|
||||
let b:ale_rust_cargo_clippy_options = '-- -D warnings'
|
||||
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo clippy --frozen --message-format=json -q -- -D warnings',
|
||||
\]
|
||||
|
||||
Execute(Clippy options work without prepending --):
|
||||
let b:ale_rust_cargo_use_clippy = 1
|
||||
let b:ale_rust_cargo_clippy_options = '-D warnings'
|
||||
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo clippy --frozen --message-format=json -q -- -D warnings',
|
||||
\]
|
||||
|
||||
Execute(Build supports all cargo flags):
|
||||
let g:ale_rust_cargo_use_check = 0
|
||||
let g:ale_rust_cargo_check_all_targets = 1
|
||||
let g:ale_rust_cargo_check_tests = 1
|
||||
let g:ale_rust_cargo_check_examples = 1
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'all'
|
||||
let b:ale_rust_cargo_target_dir = 'target/ale'
|
||||
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo build --all-targets --examples --tests --target-dir ' . ale#Escape('target/ale') . ' --frozen --message-format=json -q --all-features',
|
||||
\]
|
||||
|
||||
Execute(Clippy supports all cargo flags):
|
||||
let b:ale_rust_cargo_use_clippy = 1
|
||||
let g:ale_rust_cargo_check_all_targets = 1
|
||||
let g:ale_rust_cargo_check_tests = 1
|
||||
let g:ale_rust_cargo_check_examples = 1
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'all'
|
||||
let b:ale_rust_cargo_clippy_options = '-D warnings'
|
||||
let b:ale_rust_cargo_target_dir = 'target/ale'
|
||||
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo clippy --all-targets --examples --tests --target-dir ' . ale#Escape('target/ale') . ' --frozen --message-format=json -q --all-features -- -D warnings',
|
||||
\]
|
||||
|
||||
Execute(cargo-check does not refer ale_rust_cargo_clippy_options):
|
||||
let b:ale_rust_cargo_use_clippy = 0
|
||||
let b:ale_rust_cargo_use_check = 1
|
||||
let b:ale_rust_cargo_clippy_options = '-- -D warnings'
|
||||
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo check --frozen --message-format=json -q',
|
||||
\]
|
||||
|
||||
Execute(`cargo --target-dir` should be used when the version is new enough and it is set):
|
||||
let b:ale_rust_cargo_target_dir = 'target/ale'
|
||||
|
||||
GivenCommandOutput ['cargo 0.17.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo check --target-dir ' . ale#Escape('target/ale') . g:suffix,
|
||||
\]
|
||||
|
||||
Execute(`cargo --target-dir` should not be used when the version is not new enough and it is set):
|
||||
let b:ale_rust_cargo_target_dir = 'target/ale'
|
||||
|
||||
GivenCommandOutput ['cargo 0.16.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter 'cargo', [
|
||||
\ ale#Escape('cargo') . ' --version',
|
||||
\ 'cargo build' . g:suffix,
|
||||
\]
|
14
sources_non_forked/ale/test/linter/test_checkov.vader
Normal file
14
sources_non_forked/ale/test/linter/test_checkov.vader
Normal file
@ -0,0 +1,14 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('terraform', 'checkov')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be direct):
|
||||
AssertLinter 'checkov',
|
||||
\ ale#Escape('checkov') . ' -f %t -o json --quiet '
|
||||
|
||||
Execute(It should be possible to override the default command):
|
||||
let b:ale_terraform_checkov_executable = '/bin/other/checkov'
|
||||
AssertLinter '/bin/other/checkov',
|
||||
\ ale#Escape('/bin/other/checkov') . ' -f %t -o json --quiet '
|
72
sources_non_forked/ale/test/linter/test_checkstyle.vader
Normal file
72
sources_non_forked/ale/test/linter/test_checkstyle.vader
Normal file
@ -0,0 +1,72 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('java', 'checkstyle')
|
||||
call ale#test#SetFilename('dummy.java')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The checkstyle callback should return the correct default value):
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape('/google_checks.xml')
|
||||
\ . ' %s'
|
||||
|
||||
Execute(The checkstyle executable should be configurable):
|
||||
let b:ale_java_checkstyle_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar')
|
||||
\ . ' -c ' . ale#Escape('/google_checks.xml')
|
||||
\ . ' %s'
|
||||
|
||||
Execute(Custom options should be supported):
|
||||
let b:ale_java_checkstyle_options = '--foobar -cp -classpath /path/to/checkstyle-8.7-all.jar'
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' --foobar -cp -classpath /path/to/checkstyle-8.7-all.jar'
|
||||
\ . ' -c ' . ale#Escape('/google_checks.xml')
|
||||
\ . ' %s'
|
||||
|
||||
Execute(configuration files set in _config should be supported):
|
||||
let b:ale_java_checkstyle_config = ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml')
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' %s'
|
||||
|
||||
Execute(configuration files set in _options should be preferred over _config):
|
||||
let b:ale_java_checkstyle_config = '/foo.xml'
|
||||
let b:ale_java_checkstyle_options = '-c /bar.xml'
|
||||
|
||||
AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -c /bar.xml %s'
|
||||
|
||||
let b:ale_java_checkstyle_options = '-x -c /bar.xml'
|
||||
|
||||
AssertLinter 'checkstyle', ale#Escape('checkstyle') . ' -x -c /bar.xml %s'
|
||||
|
||||
Execute(google_checks.xml should be used by default):
|
||||
call ale#test#SetFilename('../test-files/checkstyle/test.java')
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape('/google_checks.xml')
|
||||
\ . ' %s'
|
||||
|
||||
Execute(Other relative paths should be supported):
|
||||
let b:ale_java_checkstyle_config = '../test-files/checkstyle/other_config.xml'
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' %s'
|
||||
|
||||
call ale#test#SetFilename('../test-files/checkstyle/test.java')
|
||||
|
||||
let b:ale_java_checkstyle_config = 'other_config.xml'
|
||||
|
||||
AssertLinter 'checkstyle',
|
||||
\ ale#Escape('checkstyle')
|
||||
\ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/checkstyle/other_config.xml'))
|
||||
\ . ' %s'
|
13
sources_non_forked/ale/test/linter/test_circleci.vader
Normal file
13
sources_non_forked/ale/test/linter/test_circleci.vader
Normal file
@ -0,0 +1,13 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('yaml', 'circleci')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The linter should not run for every YAML file):
|
||||
AssertLinterNotExecuted
|
||||
|
||||
Execute(The linter should for YAML files in a .circleci directory):
|
||||
call ale#test#SetFilename('../test-files/.circleci/config.yml')
|
||||
|
||||
AssertLinter 'circleci', 'circleci --skip-update-check config validate - < %s'
|
84
sources_non_forked/ale/test/linter/test_clang_tidy.vader
Normal file
84
sources_non_forked/ale/test/linter/test_clang_tidy.vader
Normal file
@ -0,0 +1,84 @@
|
||||
Before:
|
||||
Save g:ale_c_parse_makefile
|
||||
let g:ale_c_parse_makefile = 0
|
||||
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The clangtidy command default should be correct):
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' %s'
|
||||
|
||||
Execute(You should be able to remove the -checks option for clang-tidy):
|
||||
let b:ale_cpp_clangtidy_checks = []
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' %s'
|
||||
|
||||
Execute(You should be able to set other checks for clang-tidy):
|
||||
let b:ale_cpp_clangtidy_checks = ['-*', 'clang-analyzer-*']
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
|
||||
|
||||
Execute(You should be able to manually set compiler flags for clang-tidy):
|
||||
let b:ale_cpp_clangtidy_checks = ['*']
|
||||
let b:ale_cpp_clangtidy_options = '-Wall'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
|
||||
Execute(You should be able to manually set flags for clang-tidy):
|
||||
let b:ale_cpp_clangtidy_extra_options = '-config='
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' ' . ale#Escape('-config=') . ' %s'
|
||||
|
||||
Execute(The build directory should be configurable):
|
||||
let b:ale_cpp_clangtidy_checks = ['*']
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory setting should override the options):
|
||||
let b:ale_cpp_clangtidy_checks = ['*']
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_cpp_clangtidy_options = '-Wall'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory should be used for header files):
|
||||
call ale#test#SetFilename('test.h')
|
||||
|
||||
let b:ale_cpp_clangtidy_checks = ['*']
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_cpp_clangtidy_options = '-Wall'
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
call ale#test#SetFilename('test.hpp')
|
||||
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_cpp_clangtidy_checks = ['*']
|
||||
let b:ale_cpp_clangtidy_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s'
|
15
sources_non_forked/ale/test/linter/test_clj_kondo.vader
Normal file
15
sources_non_forked/ale/test/linter/test_clj_kondo.vader
Normal file
@ -0,0 +1,15 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('clojure', 'clj_kondo')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'clj-kondo', 'clj-kondo'
|
||||
\ . ' --cache --lint %t'
|
||||
|
||||
Execute(Extra options should be supported):
|
||||
let g:ale_clojure_clj_kondo_options = '--config ./clj-kondo/config.edn'
|
||||
|
||||
AssertLinter 'clj-kondo', 'clj-kondo'
|
||||
\ . ' --config ./clj-kondo/config.edn --lint %t'
|
@ -0,0 +1,13 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cmake', 'cmake_lint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'cmake-lint', ale#Escape('cmake-lint') . ' %t'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_cmake_cmake_lint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %t'
|
19
sources_non_forked/ale/test/linter/test_cookstyle.vader
Normal file
19
sources_non_forked/ale/test/linter/test_cookstyle.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('chef', 'cookstyle')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --force-exclusion --format json --stdin %s'
|
||||
|
||||
Execute(The executable path should be configurable):
|
||||
let b:ale_chef_cookstyle_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --force-exclusion --format json --stdin %s'
|
||||
|
||||
Execute(The linter options should be configurable):
|
||||
let b:ale_chef_cookstyle_options = '--parallel'
|
||||
|
||||
AssertLinter 'cookstyle', ale#Escape('cookstyle') . ' --parallel --force-exclusion --format json --stdin %s'
|
||||
|
55
sources_non_forked/ale/test/linter/test_cpp_cc.vader
Normal file
55
sources_non_forked/ale/test/linter/test_cpp_cc.vader
Normal file
@ -0,0 +1,55 @@
|
||||
Before:
|
||||
Save g:ale_c_parse_makefile
|
||||
Save g:ale_history_enabled
|
||||
|
||||
let g:ale_c_parse_makefile = 0
|
||||
let g:ale_history_enabled = 0
|
||||
|
||||
let g:get_cflags_return_value = ''
|
||||
let g:executable_map = {}
|
||||
|
||||
runtime autoload/ale/c.vim
|
||||
runtime autoload/ale/engine.vim
|
||||
|
||||
function! ale#engine#IsExecutable(buffer, executable) abort
|
||||
return has_key(g:executable_map, a:executable)
|
||||
endfunction
|
||||
|
||||
function! ale#c#GetCFlags(buffer, output) abort
|
||||
return g:get_cflags_return_value
|
||||
endfunction
|
||||
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cc')
|
||||
|
||||
let b:command_tail = ' -S -x c++'
|
||||
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ' -std=c++14 -Wall -'
|
||||
|
||||
After:
|
||||
unlet! g:get_cflags_return_value
|
||||
unlet! g:executable_map
|
||||
unlet! b:command_tail
|
||||
|
||||
runtime autoload/ale/c.vim
|
||||
runtime autoload/ale/engine.vim
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(clang++ should be used instead of gcc, if available):
|
||||
let g:executable_map = {'clang++': 1}
|
||||
|
||||
AssertLinter 'clang++', [ale#Escape('clang++') . b:command_tail]
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
|
||||
|
||||
let b:ale_cpp_cc_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
|
||||
|
||||
Execute(The -std flag should be replaced by parsed C flags):
|
||||
let b:command_tail = substitute(b:command_tail, 'c++14', 'c++11 ', '')
|
||||
let g:get_cflags_return_value = '-std=c++11'
|
||||
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
|
69
sources_non_forked/ale/test/linter/test_cpp_ccls.vader
Normal file
69
sources_non_forked/ale/test/linter/test_cpp_ccls.vader
Normal file
@ -0,0 +1,69 @@
|
||||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>
|
||||
" Description: A language server for C++
|
||||
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cpp', 'ccls')
|
||||
|
||||
Save b:ale_c_build_dir_names
|
||||
Save b:ale_cpp_ccls_executable
|
||||
Save b:ale_cpp_ccls_init_options
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The project root should be detected correctly using compile_commands.json file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.cpp')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.cpp')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json')
|
||||
|
||||
Execute(The project root should be detected correctly using .ccls file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.cpp')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.cpp')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls')
|
||||
|
||||
Execute(The project root should be detected correctly using .ccls-root file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.cpp')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_ccls-root/dummy.cpp')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/ccls/with_ccls-root')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'ccls', ale#Escape('ccls')
|
||||
|
||||
let b:ale_cpp_ccls_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
|
||||
Execute(The initialization options should be configurable):
|
||||
AssertLSPOptions {}
|
||||
|
||||
let b:ale_cpp_ccls_init_options = { 'cacheDirectory': '/tmp/ccls' }
|
||||
|
||||
AssertLSPOptions { 'cacheDirectory': '/tmp/ccls' }
|
||||
|
||||
Execute(The compile command database should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/ccls/with_ccls/dummy.c')
|
||||
|
||||
AssertLSPOptions {}
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_compile_commands_json/dummy.c')
|
||||
|
||||
AssertLSPOptions { 'compilationDatabaseDirectory':
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/ccls/with_compile_commands_json') }
|
||||
|
||||
call ale#test#SetFilename('../test-files/ccls/with_build_dir/dummy.c')
|
||||
let b:ale_c_build_dir_names = ['unusual_build_dir_name']
|
||||
|
||||
AssertLSPOptions { 'compilationDatabaseDirectory':
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/ccls/with_build_dir/unusual_build_dir_name') }
|
35
sources_non_forked/ale/test/linter/test_cpp_clangcheck.vader
Normal file
35
sources_non_forked/ale/test/linter/test_cpp_clangcheck.vader
Normal file
@ -0,0 +1,35 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clangcheck')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics'
|
||||
|
||||
let b:ale_cpp_clangcheck_executable = 'foobar'
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated.
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar')
|
||||
\ . ' -analyze %s --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_cpp_clangcheck_options = '--something'
|
||||
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s'
|
||||
\ . ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics'
|
||||
\ . ' --something'
|
||||
|
||||
Execute(The build directory should be used when set):
|
||||
let b:ale_cpp_clangcheck_options = '--something'
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s --something -p ' . ale#Escape('/foo/bar')
|
56
sources_non_forked/ale/test/linter/test_cpp_clazy.vader
Normal file
56
sources_non_forked/ale/test/linter/test_cpp_clazy.vader
Normal file
@ -0,0 +1,56 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clazy')
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The clazy command default should be correct):
|
||||
AssertLinter 'clazy-standalone',
|
||||
\ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' %s'
|
||||
|
||||
Execute(You should be able to remove the -checks option for clazy-standalone):
|
||||
let b:ale_cpp_clazy_checks = []
|
||||
|
||||
AssertLinter 'clazy-standalone', ale#Escape('clazy-standalone') . ' %s'
|
||||
|
||||
Execute(You should be able to set other checks for clazy-standalone):
|
||||
let b:ale_cpp_clazy_checks = ['level2', 'level3']
|
||||
|
||||
AssertLinter 'clazy-standalone',
|
||||
\ ale#Escape('clazy-standalone')
|
||||
\ . ' -checks=' . ale#Escape('level2,level3') . ' %s'
|
||||
|
||||
Execute(You should be able to manually set compiler flags for clazy-standalone):
|
||||
let b:ale_cpp_clazy_options = '-qt4-compat'
|
||||
|
||||
AssertLinter 'clazy-standalone',
|
||||
\ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' -qt4-compat' . ' %s'
|
||||
\
|
||||
Execute(The build directory should be configurable):
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
|
||||
AssertLinter 'clazy-standalone',
|
||||
\ ale#Escape('clazy-standalone')
|
||||
\ . ' -checks=' . ale#Escape('level1') . ' -p ' . ale#Escape('/foo/bar') . ' %s'
|
||||
|
||||
Execute(The build directory should be used for header files):
|
||||
call ale#test#SetFilename('test.h')
|
||||
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
|
||||
AssertLinter 'clazy-standalone',
|
||||
\ ale#Escape('clazy-standalone')
|
||||
\ . ' -checks=' . ale#Escape('level1') . ' -p ' . ale#Escape('/foo/bar') . ' %s'
|
||||
|
||||
call ale#test#SetFilename('test.hpp')
|
||||
|
||||
AssertLinter 'clazy-standalone',
|
||||
\ ale#Escape('clazy-standalone')
|
||||
\ . ' -checks=' . ale#Escape('level1') . ' -p ' . ale#Escape('/foo/bar') . ' %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_cpp_clazy_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -checks=' . ale#Escape('level1') . ' %s'
|
83
sources_non_forked/ale/test/linter/test_cpp_cppcheck.vader
Normal file
83
sources_non_forked/ale/test/linter/test_cpp_cppcheck.vader
Normal file
@ -0,0 +1,83 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cppcheck')
|
||||
let b:command_tail = ' -q --language=c++ --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') . ' --enable=style -I' . ale#Escape(ale#path#Simplify(g:dir)) .' %t'
|
||||
|
||||
After:
|
||||
" Remove a test file we might open for some tests.
|
||||
if &buftype != 'nofile'
|
||||
set nomodified
|
||||
set buftype=nofile
|
||||
endif
|
||||
|
||||
unlet! b:rel_file_path
|
||||
unlet! b:command_tail
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail
|
||||
|
||||
let b:ale_cpp_cppcheck_executable = 'foobar'
|
||||
|
||||
AssertLinterCwd ''
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
||||
Execute(cppcheck for C++ should detect compile_commands.json files):
|
||||
let b:rel_file_path = '../test-files/cppcheck/one/foo.cpp'
|
||||
call ale#test#SetFilename(b:rel_file_path)
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c++'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' --project=' . ale#Escape('compile_commands.json')
|
||||
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
|
||||
\ . ' --enable=style %t'
|
||||
|
||||
Execute(cppcheck for C++ should detect compile_commands.json files in build directories):
|
||||
let b:rel_file_path = '../test-files/cppcheck/with_build_dir/foo.cpp'
|
||||
call ale#test#SetFilename(b:rel_file_path)
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/with_build_dir')
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c++'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
|
||||
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
|
||||
\ . ' --enable=style %t'
|
||||
|
||||
Execute(cppcheck for C++ should include file dir if compile_commands.json file is not found):
|
||||
call ale#test#SetFilename('../test-files/cppcheck/foo.cpp')
|
||||
|
||||
AssertLinter 'cppcheck',
|
||||
\ ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c++'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' --enable=style'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck'))
|
||||
\ . ' %t'
|
||||
|
||||
Execute(cppcheck for C++ header should include file dir and not use compile_commands.json):
|
||||
call ale#test#SetFilename('../test-files/cppcheck/one/foo.hpp')
|
||||
|
||||
AssertLinter 'cppcheck',
|
||||
\ ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c++'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one'))
|
||||
\ . ' --suppress=unusedStructMember'
|
||||
\ . ' --enable=style'
|
||||
\ . ' %t'
|
||||
|
||||
Execute(cppcheck for C++ should ignore compile_commands.json file if buffer is modified):
|
||||
call ale#test#SetFilename('../test-files/cppcheck/one/foo.cpp')
|
||||
|
||||
set buftype=
|
||||
set modified
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/cppcheck/one')
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c++'
|
||||
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
\ . ' --enable=style'
|
||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cppcheck/one'))
|
||||
\ . ' %t'
|
40
sources_non_forked/ale/test/linter/test_cpp_cquery.vader
Normal file
40
sources_non_forked/ale/test/linter/test_cpp_cquery.vader
Normal file
@ -0,0 +1,40 @@
|
||||
" Author: Ben Falconer <ben@falconers.me.uk>
|
||||
" Description: A language server for C++
|
||||
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cquery')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The project root should be detected correctly using compile_commands.json file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.cpp')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/cquery/dummy.cpp')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery')
|
||||
|
||||
Execute(The project root should be detected correctly using .cquery file):
|
||||
call ale#test#SetFilename(tempname() . '/dummy.cpp')
|
||||
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/cquery/with_cquery/dummy.cpp')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/cquery/with_cquery')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'cquery', ale#Escape('cquery')
|
||||
|
||||
let b:ale_cpp_cquery_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
|
||||
Execute(The cache directory should be configurable):
|
||||
AssertLSPOptions {'cacheDirectory': expand('$HOME/.cache/cquery')}
|
||||
|
||||
let b:ale_cpp_cquery_cache_directory = '/foo/bar'
|
||||
|
||||
AssertLSPOptions {'cacheDirectory': '/foo/bar'}
|
26
sources_non_forked/ale/test/linter/test_cpp_flawfinder.vader
Normal file
26
sources_non_forked/ale/test/linter/test_cpp_flawfinder.vader
Normal file
@ -0,0 +1,26 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cpp', 'flawfinder')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The flawfinder command should be correct):
|
||||
AssertLinter 'flawfinder',
|
||||
\ ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t'
|
||||
|
||||
Execute(The minlevel of flawfinder should be configurable):
|
||||
let b:ale_cpp_flawfinder_minlevel = 8
|
||||
|
||||
AssertLinter 'flawfinder',
|
||||
\ ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t'
|
||||
|
||||
Execute(Additional flawfinder options should be configurable):
|
||||
let b:ale_cpp_flawfinder_options = ' --foobar'
|
||||
|
||||
AssertLinter 'flawfinder',
|
||||
\ ale#Escape('flawfinder') . ' -CDQS --foobar --minlevel=1 %t'
|
||||
|
||||
Execute(The flawfinder exectable should be configurable):
|
||||
let b:ale_cpp_flawfinder_executable = 'foo/bar'
|
||||
|
||||
AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t'
|
17
sources_non_forked/ale/test/linter/test_cpplint.vader
Normal file
17
sources_non_forked/ale/test/linter/test_cpplint.vader
Normal file
@ -0,0 +1,17 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cpplint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'cpplint', ale#Escape('cpplint') . ' %s'
|
||||
|
||||
let b:ale_cpp_cpplint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_cpp_cpplint_options = '--something'
|
||||
|
||||
AssertLinter 'cpplint', ale#Escape('cpplint') . ' --something %s'
|
42
sources_non_forked/ale/test/linter/test_cs_csc.vader
Normal file
42
sources_non_forked/ale/test/linter/test_cs_csc.vader
Normal file
@ -0,0 +1,42 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cs', 'csc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The csc linter should return the correct default command):
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The options should be be used in the command):
|
||||
let g:ale_cs_csc_options = ''
|
||||
|
||||
AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The souce path should be be used in the command):
|
||||
let g:ale_cs_csc_source = '../foo/bar'
|
||||
|
||||
AssertLinterCwd '../foo/bar'
|
||||
AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The list of search pathes for assemblies should be be used in the command if not empty):
|
||||
let g:ale_cs_csc_assembly_path = ['/usr/lib/mono', '../foo/bar']
|
||||
|
||||
AssertLinter 'csc', 'csc /unsafe'
|
||||
\ . ' /lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar')
|
||||
\ . ' /out:TEMP /t:module /recurse:' . ale#Escape('*.cs')
|
||||
|
||||
let g:ale_cs_csc_assembly_path = []
|
||||
|
||||
AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The list of assemblies should be be used in the command if not empty):
|
||||
let g:ale_cs_csc_assemblies = ['foo.dll', 'bar.dll']
|
||||
|
||||
AssertLinter 'csc', 'csc /unsafe'
|
||||
\ . ' /r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll')
|
||||
\ . ' /out:TEMP /t:module /recurse:' . ale#Escape('*.cs')
|
||||
|
||||
let g:ale_cs_csc_assemblies = []
|
||||
|
||||
AssertLinter 'csc', 'csc /unsafe /out:TEMP /t:module /recurse:' . ale#Escape('*.cs')
|
13
sources_non_forked/ale/test/linter/test_cs_mcs.vader
Normal file
13
sources_non_forked/ale/test/linter/test_cs_mcs.vader
Normal file
@ -0,0 +1,13 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cs', 'mcs')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'mcs', 'mcs -unsafe --parse %t'
|
||||
|
||||
Execute(The options should be be used in the command):
|
||||
let b:ale_cs_mcs_options = '-pkg:dotnet'
|
||||
|
||||
AssertLinter 'mcs', 'mcs -unsafe --parse -pkg:dotnet %t'
|
42
sources_non_forked/ale/test/linter/test_cs_mcsc.vader
Normal file
42
sources_non_forked/ale/test/linter/test_cs_mcsc.vader
Normal file
@ -0,0 +1,42 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cs', 'mcsc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The mcsc linter should return the correct default command):
|
||||
AssertLinterCwd expand('%:p:h')
|
||||
AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The options should be be used in the command):
|
||||
let g:ale_cs_mcsc_options = '-pkg:dotnet'
|
||||
|
||||
AssertLinter 'mcs', 'mcs -unsafe -pkg:dotnet -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The souce path should be be used in the command):
|
||||
let g:ale_cs_mcsc_source = '../foo/bar'
|
||||
|
||||
AssertLinterCwd '../foo/bar'
|
||||
AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The list of search pathes for assemblies should be be used in the command if not empty):
|
||||
let g:ale_cs_mcsc_assembly_path = ['/usr/lib/mono', '../foo/bar']
|
||||
|
||||
AssertLinter 'mcs', 'mcs -unsafe'
|
||||
\ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar')
|
||||
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
||||
let g:ale_cs_mcsc_assembly_path = []
|
||||
|
||||
AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
||||
Execute(The list of assemblies should be be used in the command if not empty):
|
||||
let g:ale_cs_mcsc_assemblies = ['foo.dll', 'bar.dll']
|
||||
|
||||
AssertLinter 'mcs', 'mcs -unsafe'
|
||||
\ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll')
|
||||
\ . ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
||||
let g:ale_cs_mcsc_assemblies = []
|
||||
|
||||
AssertLinter 'mcs', 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
71
sources_non_forked/ale/test/linter/test_cspell.vader
Normal file
71
sources_non_forked/ale/test/linter/test_cspell.vader
Normal file
@ -0,0 +1,71 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('tex', 'cspell')
|
||||
|
||||
" We have to manually do our own variable reset because SetUpLinterTest calls
|
||||
" ale#assert#ResetVariables, which specifically only resets variables that
|
||||
" begin with ale_<filetype>_, per https://github.com/dense-analysis/ale/blob/76c2293e68a6cad3b192062743d25b8daa082205/autoload/ale/assert.vim#L256
|
||||
"
|
||||
" Took a lot of debugging and reading both junegunn/vader.vim and most ALE
|
||||
" files to find this behavior
|
||||
|
||||
Save g:ale_cspell_executable
|
||||
Save g:ale_cspell_use_global
|
||||
Save g:ale_cspell_options
|
||||
|
||||
unlet! g:ale_cspell_executable
|
||||
unlet! g:ale_cspell_use_global
|
||||
unlet! g:ale_cspell_options
|
||||
|
||||
let g:ale_cspell_executable = 'cspell'
|
||||
let g:ale_cspell_use_global = 0
|
||||
let g:ale_cspell_options = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The global executable should be used when the local one cannot be found):
|
||||
AssertLinter
|
||||
\ 'cspell',
|
||||
\ ale#Escape('cspell')
|
||||
\ . ' lint --no-color --no-progress --no-summary -- stdin'
|
||||
|
||||
Execute(Should use the node_modules/.bin executable if available):
|
||||
call ale#test#SetFilename('../test-files/cspell/node-modules/test.tex')
|
||||
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir
|
||||
\ . '/../test-files/cspell/node-modules/node_modules/.bin/cspell'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir
|
||||
\ . '/../test-files/cspell/node-modules/node_modules/.bin/cspell'))
|
||||
\ . ' lint --no-color --no-progress --no-summary -- stdin'
|
||||
|
||||
Execute(Should use the node_modules/cspell executable if available):
|
||||
call ale#test#SetFilename('../test-files/cspell/node-modules-2/test.tex')
|
||||
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir
|
||||
\ . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js'),
|
||||
\ (has('win32') ? 'node.exe ': '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir
|
||||
\ . '/../test-files/cspell/node-modules-2/node_modules/cspell/bin.js'))
|
||||
\ . ' lint --no-color --no-progress --no-summary -- stdin'
|
||||
|
||||
Execute(Should let users configure a global executable and override local paths):
|
||||
let g:ale_cspell_executable = '/path/to/custom/cspell'
|
||||
let g:ale_cspell_use_global = 1
|
||||
|
||||
AssertLinter
|
||||
\ '/path/to/custom/cspell',
|
||||
\ ale#Escape('/path/to/custom/cspell')
|
||||
\ . ' lint --no-color --no-progress --no-summary -- stdin'
|
||||
|
||||
Execute(Additional cspell options should be configurable):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
let g:ale_cspell_options = '--foobar'
|
||||
|
||||
AssertLinter
|
||||
\ 'cspell',
|
||||
\ ale#Escape('cspell')
|
||||
\ . ' lint --no-color --no-progress --no-summary --foobar -- stdin'
|
||||
|
18
sources_non_forked/ale/test/linter/test_cucumber.vader
Normal file
18
sources_non_forked/ale/test/linter/test_cucumber.vader
Normal file
@ -0,0 +1,18 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cucumber', 'cucumber')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Should require the nearest features dir, if one is found):
|
||||
call ale#test#SetFilename('../test-files/cucumber/features/cuke.feature')
|
||||
|
||||
AssertLinter 'cucumber',
|
||||
\ 'cucumber --dry-run --quiet --strict --format=json '
|
||||
\ . '-r ' . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/cucumber/features/')) . ' %t'
|
||||
|
||||
Execute(Should require nothing if no features dir is found):
|
||||
call ale#test#SetFilename('something/without/a/features/dir')
|
||||
|
||||
AssertLinter 'cucumber',
|
||||
\ 'cucumber --dry-run --quiet --strict --format=json %t'
|
20
sources_non_forked/ale/test/linter/test_cuda_nvcc.vader
Normal file
20
sources_non_forked/ale/test/linter/test_cuda_nvcc.vader
Normal file
@ -0,0 +1,20 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cuda', 'nvcc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'nvcc',
|
||||
\ ale#Escape('nvcc') . ' -cuda -std=c++11 %s -o ' . g:ale#util#nul_file
|
||||
|
||||
let b:ale_cuda_nvcc_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -cuda -std=c++11 %s -o ' . g:ale#util#nul_file
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let g:ale_cuda_nvcc_options = '--foobar'
|
||||
|
||||
AssertLinter 'nvcc',
|
||||
\ ale#Escape('nvcc') . ' -cuda --foobar %s -o ' . g:ale#util#nul_file
|
@ -0,0 +1,8 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('cypher', 'cypher_lint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command and executable should be correct):
|
||||
AssertLinter 'cypher-lint', 'cypher-lint'
|
19
sources_non_forked/ale/test/linter/test_d_dls.vader
Normal file
19
sources_non_forked/ale/test/linter/test_d_dls.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('d', 'dls')
|
||||
|
||||
Save &filetype
|
||||
let &filetype = 'd'
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The language string should be correct):
|
||||
AssertLSPLanguage 'd'
|
||||
|
||||
Execute(The default executable should be correct):
|
||||
AssertLinter 'dls', 'dls'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_d_dls_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', 'foobar'
|
@ -0,0 +1,15 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('dart', 'analysis_server')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'dart', ale#Escape('dart')
|
||||
\ . ' ./snapshots/analysis_server.dart.snapshot --lsp'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_dart_analysis_server_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
\ . ' ./snapshots/analysis_server.dart.snapshot --lsp'
|
@ -0,0 +1,8 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('dart', 'language_server')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'dart_language_server', ale#Escape('dart_language_server')
|
@ -0,0 +1,15 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('desktop', 'desktop_file_validate')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'desktop-file-validate',
|
||||
\ ale#Escape('desktop-file-validate') . ' %t'
|
||||
|
||||
Execute(Extra options should work):
|
||||
let b:ale_desktop_desktop_file_validate_options = '--warn-kde'
|
||||
|
||||
AssertLinter 'desktop-file-validate',
|
||||
\ ale#Escape('desktop-file-validate') . ' --warn-kde %t'
|
16
sources_non_forked/ale/test/linter/test_dialyxir.vader
Normal file
16
sources_non_forked/ale/test/linter/test_dialyxir.vader
Normal file
@ -0,0 +1,16 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elixir', 'dialyxir')
|
||||
call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Builds dialyxir command with a normal project):
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project')
|
||||
AssertLinter 'mix', 'mix help dialyzer && mix dialyzer'
|
||||
|
||||
Execute(Builds dialyxir command with an umbrella project):
|
||||
call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project')
|
||||
AssertLinter 'mix', 'mix help dialyzer && mix dialyzer'
|
@ -0,0 +1,96 @@
|
||||
Before:
|
||||
runtime ale_linters/d/dmd.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(DMD command line should be correct with imports):
|
||||
AssertEqual
|
||||
\ 'dmd ' .
|
||||
\ '-I' . ale#Escape('source') . ' ' .
|
||||
\ '-I' . ale#Escape('/prefix/include/d') . ' ' .
|
||||
\ '-I' . ale#Escape('/home/user/.dub/packages/pkg-0.0.1/pkg/src') . ' ' .
|
||||
\ ' ' .
|
||||
\ ' ' .
|
||||
\ ' ' .
|
||||
\ '-o- -wi -vcolumns -c %t',
|
||||
\ ale_linters#d#dmd#DMDCommand(bufnr(''), [
|
||||
\ 'source',
|
||||
\ '/prefix/include/d',
|
||||
\ '/home/user/.dub/packages/pkg-0.0.1/pkg/src',
|
||||
\ '',
|
||||
\ '',
|
||||
\ '',
|
||||
\ '',
|
||||
\ '',
|
||||
\ '',
|
||||
\ ], {})
|
||||
|
||||
Execute(DMD command line should be correct with imports and version):
|
||||
AssertEqual
|
||||
\ 'dmd ' .
|
||||
\ '-I' . ale#Escape('source') . ' ' .
|
||||
\ '-I' . ale#Escape('/prefix/include/d') . ' ' .
|
||||
\ '-I' . ale#Escape('/home/user/.dub/packages/pkg-0.0.1/pkg/src') . ' ' .
|
||||
\ ' ' .
|
||||
\ '-version=' . ale#Escape('SOME_VERSION') . ' ' .
|
||||
\ ' ' .
|
||||
\ '-o- -wi -vcolumns -c %t',
|
||||
\ ale_linters#d#dmd#DMDCommand(bufnr(''), [
|
||||
\ 'source',
|
||||
\ '/prefix/include/d',
|
||||
\ '/home/user/.dub/packages/pkg-0.0.1/pkg/src',
|
||||
\ '',
|
||||
\ '',
|
||||
\ '',
|
||||
\ 'SOME_VERSION',
|
||||
\ '',
|
||||
\ '',
|
||||
\ ], {})
|
||||
|
||||
Execute(DMD command line should be correct):
|
||||
AssertEqual
|
||||
\ 'dmd ' .
|
||||
\ '-I' . ale#Escape('source') . ' ' .
|
||||
\ '-I' . ale#Escape('/prefix/include/d') . ' ' .
|
||||
\ '-I' . ale#Escape('/home/user/.dub/packages/pkg-0.0.1/pkg/src') . ' ' .
|
||||
\ '-J' . ale#Escape('views') . ' ' .
|
||||
\ '-version=' . ale#Escape('SOME_VERSION') . ' ' .
|
||||
\ '-version=' . ale#Escape('SOME_OTHER_VERSION') . ' ' .
|
||||
\ '-debug=' . ale#Escape('SomeFeature') . ' ' .
|
||||
\ '-o- -wi -vcolumns -c %t',
|
||||
\ ale_linters#d#dmd#DMDCommand(bufnr(''), [
|
||||
\ 'source',
|
||||
\ '/prefix/include/d',
|
||||
\ '/home/user/.dub/packages/pkg-0.0.1/pkg/src',
|
||||
\ '',
|
||||
\ 'views',
|
||||
\ '',
|
||||
\ 'SOME_VERSION',
|
||||
\ 'SOME_OTHER_VERSION',
|
||||
\ '',
|
||||
\ 'SomeFeature',
|
||||
\ ], {})
|
||||
|
||||
Execute(DMD command line should be correct with CR):
|
||||
" on windows, the function is called with carriage return
|
||||
AssertEqual
|
||||
\ 'dmd ' .
|
||||
\ '-I' . ale#Escape('source') . ' ' .
|
||||
\ '-I' . ale#Escape('C:\prefix\include\d') . ' ' .
|
||||
\ '-I' . ale#Escape('C:\Users\user\AppData\Local\Dub\packages\pkg-0.0.1\pkg\src') . ' ' .
|
||||
\ ' ' .
|
||||
\ ' ' .
|
||||
\ ' ' .
|
||||
\ '-o- -wi -vcolumns -c %t',
|
||||
\ ale_linters#d#dmd#DMDCommand(bufnr(''), [
|
||||
\ "source\r",
|
||||
\ "C:\\prefix\\include\\d\r",
|
||||
\ "C:\\Users\\user\\AppData\\Local\\Dub\\packages\\pkg-0.0.1\\pkg\\src\r",
|
||||
\ "\r",
|
||||
\ "\r",
|
||||
\ "\r",
|
||||
\ "\r",
|
||||
\ "\r",
|
||||
\ "\r",
|
||||
\ ], {})
|
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('dockerfile', 'dockerfile_lint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'dockerfile_lint', ale#Escape('dockerfile_lint') . ' -p -j -f %t'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_dockerfile_dockerfile_lint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' -p -j -f %t'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_dockerfile_dockerfile_lint_options = '-r additional.yaml'
|
||||
|
||||
AssertLinter 'dockerfile_lint', ale#Escape('dockerfile_lint') . ' -r additional.yaml -p -j -f %t'
|
||||
|
16
sources_non_forked/ale/test/linter/test_dogma.vader
Normal file
16
sources_non_forked/ale/test/linter/test_dogma.vader
Normal file
@ -0,0 +1,16 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elixir', 'dogma')
|
||||
call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Builds dogma command with a normal project):
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project')
|
||||
AssertLinter 'mix', 'mix help dogma && mix dogma %s --format=flycheck'
|
||||
|
||||
Execute(Builds dogma command with an umbrella project):
|
||||
call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project')
|
||||
AssertLinter 'mix', 'mix help dogma && mix dogma %s --format=flycheck'
|
111
sources_non_forked/ale/test/linter/test_eclipselsp.vader
Normal file
111
sources_non_forked/ale/test/linter/test_eclipselsp.vader
Normal file
@ -0,0 +1,111 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('java', 'eclipselsp')
|
||||
call ale#test#SetFilename('dummy.java')
|
||||
|
||||
let b:ale_java_eclipselsp_path = '/home/user/eclipse.dst.ls'
|
||||
|
||||
let b:cfg = ale#path#Simplify(g:dir . '/../config_linux')
|
||||
|
||||
if has('win32')
|
||||
let b:cfg = ale#path#Simplify(g:dir . '/../config_win')
|
||||
elseif has('macunix')
|
||||
let b:cfg = ale#path#Simplify(g:dir . '/../config_mac')
|
||||
endif
|
||||
|
||||
After:
|
||||
unlet! b:ale_java_eclipselsp_path
|
||||
unlet! b:cfg
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(VersionCheck should return correct version):
|
||||
|
||||
" OpenJDK Java 1.8
|
||||
AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([
|
||||
\ 'openjdk version "1.8.0_191"',
|
||||
\ 'OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-0ubuntu0.18.04.1-b12)',
|
||||
\ 'OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)'
|
||||
\])
|
||||
|
||||
" OpenJDK Java 10
|
||||
AssertEqual [10, 0, 2], ale_linters#java#eclipselsp#VersionCheck([
|
||||
\ 'openjdk version "10.0.2" 2018-07-17',
|
||||
\ 'OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)',
|
||||
\ 'OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)'
|
||||
\])
|
||||
|
||||
" Oracle Java 1.8
|
||||
AssertEqual [1, 8, 0], ale_linters#java#eclipselsp#VersionCheck([
|
||||
\ 'java version "1.8.0_161"',
|
||||
\ 'Java(TM) SE Runtime Environment (build 1.8.0_161-b12)',
|
||||
\ 'Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)'
|
||||
\])
|
||||
|
||||
" Oracle Java 10
|
||||
AssertEqual [10, 0, 1], ale_linters#java#eclipselsp#VersionCheck([
|
||||
\ 'java version "10.0.1" 2018-04-17',
|
||||
\ 'Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)',
|
||||
\ 'Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)'
|
||||
\])
|
||||
|
||||
AssertEqual [], ale_linters#java#eclipselsp#VersionCheck(['x'])
|
||||
|
||||
AssertEqual [], ale_linters#java#eclipselsp#VersionCheck([])
|
||||
|
||||
Execute(The eclipselsp callback should return the correct default value):
|
||||
let cmd = [ ale#Escape('java'),
|
||||
\ '',
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
\ '-Dlog.level=ALL',
|
||||
\ '-noverify',
|
||||
\ '-Xmx1G',
|
||||
\ '-jar',
|
||||
\ ale#Escape(''),
|
||||
\ '-configuration',
|
||||
\ ale#Escape(b:cfg),
|
||||
\ '-data',
|
||||
\ ale#Escape(ale#path#Simplify(''))
|
||||
\]
|
||||
AssertLinter 'java', join(cmd, ' ')
|
||||
|
||||
Execute(The eclipselsp callback should allow custom executable):
|
||||
let b:ale_java_eclipselsp_executable='/bin/foobar'
|
||||
let cmd = [ ale#Escape('/bin/foobar'),
|
||||
\ '',
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
\ '-Dlog.level=ALL',
|
||||
\ '-noverify',
|
||||
\ '-Xmx1G',
|
||||
\ '-jar',
|
||||
\ ale#Escape(''),
|
||||
\ '-configuration',
|
||||
\ ale#Escape(b:cfg),
|
||||
\ '-data',
|
||||
\ ale#Escape(ale#path#Simplify(''))
|
||||
\]
|
||||
AssertLinter '/bin/foobar', join(cmd, ' ')
|
||||
|
||||
Execute(The eclipselsp callback should allow custom configuration path and javaagent):
|
||||
let b:ale_java_eclipselsp_config_path = '/home/config'
|
||||
let b:ale_java_eclipselsp_javaagent = '/home/lombok.jar /home/lombok2.jar'
|
||||
let cmd = [ ale#Escape('java'),
|
||||
\ ale#Escape('-javaagent:/home/lombok.jar'),
|
||||
\ ale#Escape('-javaagent:/home/lombok2.jar'),
|
||||
\ '-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||
\ '-Dosgi.bundles.defaultStartLevel=4',
|
||||
\ '-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||
\ '-Dlog.level=ALL',
|
||||
\ '-noverify',
|
||||
\ '-Xmx1G',
|
||||
\ '-jar',
|
||||
\ ale#Escape(''),
|
||||
\ '-configuration',
|
||||
\ ale#Escape(ale#path#Simplify('/home/config')),
|
||||
\ '-data',
|
||||
\ ale#Escape(ale#path#Simplify(''))
|
||||
\]
|
||||
AssertLinter 'java', join(cmd, ' ')
|
43
sources_non_forked/ale/test/linter/test_elixir_credo.vader
Normal file
43
sources_non_forked/ale/test/linter/test_elixir_credo.vader
Normal file
@ -0,0 +1,43 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elixir', 'credo')
|
||||
call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex')
|
||||
|
||||
|
||||
After:
|
||||
unlet! g:ale_elixir_credo_strict
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Builds credo command with normal project):
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project')
|
||||
AssertLinter 'mix',
|
||||
\ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||
|
||||
Execute(Builds credo command with umbrella project):
|
||||
call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project')
|
||||
AssertLinter 'mix',
|
||||
\ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||
|
||||
Execute(Builds credo command with --strict mode when set to 1):
|
||||
let g:ale_elixir_credo_strict = 1
|
||||
|
||||
AssertLinter 'mix',
|
||||
\ 'mix help credo && mix credo --strict --format=flycheck --read-from-stdin %s'
|
||||
|
||||
Execute(Builds credo command with suggest mode by default):
|
||||
AssertLinter 'mix',
|
||||
\ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||
|
||||
Execute(Builds credo command with suggest mode when set to 0):
|
||||
let g:ale_elixir_credo_strict = 0
|
||||
|
||||
AssertLinter 'mix',
|
||||
\ 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||
|
||||
Execute(Builds credo command with a custom config file):
|
||||
let g:ale_elixir_credo_config_file = '/home/user/custom_credo.exs'
|
||||
|
||||
AssertLinter 'mix',
|
||||
\ 'mix help credo && mix credo suggest --config-file /home/user/custom_credo.exs --format=flycheck --read-from-stdin %s'
|
34
sources_non_forked/ale/test/linter/test_elixir_ls.vader
Normal file
34
sources_non_forked/ale/test/linter/test_elixir_ls.vader
Normal file
@ -0,0 +1,34 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elixir', 'elixir_ls')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(should set correct defaults):
|
||||
if has('win32')
|
||||
AssertLinter 'elixir-ls\language_server.bat', 'elixir-ls\language_server.bat'
|
||||
else
|
||||
AssertLinter 'elixir-ls/language_server.sh', 'elixir-ls/language_server.sh'
|
||||
endif
|
||||
|
||||
Execute(should configure elixir-ls release location):
|
||||
let b:ale_elixir_elixir_ls_release = 'boo'
|
||||
|
||||
if has('win32')
|
||||
AssertLinter 'boo\language_server.bat', 'boo\language_server.bat'
|
||||
else
|
||||
AssertLinter 'boo/language_server.sh', 'boo/language_server.sh'
|
||||
endif
|
||||
|
||||
Execute(should set correct LSP values):
|
||||
call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/app1/lib/app.ex')
|
||||
|
||||
AssertLSPLanguage 'elixir'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project')
|
||||
|
||||
Execute(should accept configuration settings):
|
||||
AssertLSPConfig {}
|
||||
let b:ale_elixir_elixir_ls_config = {'elixirLS': {'dialyzerEnabled': v:false}}
|
||||
AssertLSPConfig {'elixirLS': {'dialyzerEnabled': v:false}}
|
19
sources_non_forked/ale/test/linter/test_elixir_mix.vader
Normal file
19
sources_non_forked/ale/test/linter/test_elixir_mix.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elixir', 'mix')
|
||||
call ale#test#SetFilename('../test-files/elixir/mix_project/lib/app.ex')
|
||||
let g:env_prefix = ale#Env('MIX_BUILD_PATH', 'TEMP_DIR')
|
||||
|
||||
After:
|
||||
unlet! g:env_prefix
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default mix command should be correct):
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/mix_project')
|
||||
AssertLinter 'mix', g:env_prefix . 'mix compile %s'
|
||||
|
||||
Execute(Build mix commands with an umbrella root):
|
||||
call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/mix_project/lib/app.ex')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project')
|
||||
AssertLinter 'mix', g:env_prefix . 'mix compile %s'
|
29
sources_non_forked/ale/test/linter/test_elm_ls.vader
Normal file
29
sources_non_forked/ale/test/linter/test_elm_ls.vader
Normal file
@ -0,0 +1,29 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elm', 'elm_ls')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path should be correct):
|
||||
call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm')
|
||||
|
||||
AssertLinter 'elm-language-server', ale#Escape('elm-language-server') . ' --stdio'
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/elm/newapp')
|
||||
|
||||
Execute(Should let users configure a global executable and override local paths):
|
||||
call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm')
|
||||
|
||||
let g:ale_elm_ls_executable = '/path/to/custom/elm-language-server'
|
||||
let g:ale_elm_ls_use_global = 1
|
||||
|
||||
AssertLinter '/path/to/custom/elm-language-server',
|
||||
\ ale#Escape('/path/to/custom/elm-language-server') . ' --stdio'
|
||||
|
||||
Execute(The language should be correct):
|
||||
AssertLSPLanguage 'elm'
|
63
sources_non_forked/ale/test/linter/test_elm_make.vader
Normal file
63
sources_non_forked/ale/test/linter/test_elm_make.vader
Normal file
@ -0,0 +1,63 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elm', 'make')
|
||||
|
||||
After:
|
||||
unlet! g:executable
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(should get valid executable with default params):
|
||||
call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm')
|
||||
|
||||
let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/newapp/node_modules/.bin/elm')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp')
|
||||
AssertLinter g:executable,
|
||||
\ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t'
|
||||
|
||||
Execute(should get elm-test executable for test code with elm >= 0.19):
|
||||
call ale#test#SetFilename('../test-files/elm/newapp/tests/TestSuite.elm')
|
||||
|
||||
let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/newapp/node_modules/.bin/elm-test')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp')
|
||||
AssertLinter g:executable,
|
||||
\ ale#Escape(g:executable) . ' make --report=json --output=/dev/null --compiler '
|
||||
\ . ale#path#Simplify(g:dir . '/../test-files/elm/newapp/node_modules/.bin/elm') . ' %t'
|
||||
|
||||
Execute(should fallback to elm executable with elm >= 0.19):
|
||||
call ale#test#SetFilename('../test-files/elm/newapp-notests/tests/TestMain.elm')
|
||||
|
||||
let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/newapp-notests/node_modules/.bin/elm')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp-notests')
|
||||
AssertLinter g:executable,
|
||||
\ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t'
|
||||
|
||||
Execute(should get plain elm executable for test code with elm < 0.19):
|
||||
call ale#test#SetFilename('../test-files/elm/oldapp/tests/TestSuite.elm')
|
||||
|
||||
let g:executable = ale#path#Simplify(g:dir . '/../test-files/elm/oldapp/node_modules/.bin/elm')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/oldapp')
|
||||
AssertLinter g:executable,
|
||||
\ ale#Escape(g:executable) . ' make --report=json --output=/dev/null %t'
|
||||
|
||||
Execute(should get valid executable with 'use_global' params):
|
||||
let g:ale_elm_make_use_global = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp')
|
||||
AssertLinter 'elm',
|
||||
\ ale#Escape('elm') . ' make --report=json --output=/dev/null %t'
|
||||
|
||||
Execute(should get valid executable with 'use_global' and 'executable' params):
|
||||
let g:ale_elm_make_executable = 'other-elm'
|
||||
let g:ale_elm_make_use_global = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/elm/newapp/src/Main.elm')
|
||||
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/elm/newapp')
|
||||
AssertLinter 'other-elm',
|
||||
\ ale#Escape('other-elm') . ' make --report=json --output=/dev/null %t'
|
@ -0,0 +1,23 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('handlebars', 'embertemplatelint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Runs the right command for ember-template-lint >= 4.x):
|
||||
GivenCommandOutput ['4.0.0']
|
||||
|
||||
AssertLinter 'ember-template-lint',
|
||||
\ ale#Escape('ember-template-lint') . ' --format=json --filename %s'
|
||||
|
||||
Execute(Runs the right command for ember-template-lint >= 1.6, < 4.x):
|
||||
GivenCommandOutput ['1.6.0']
|
||||
|
||||
AssertLinter 'ember-template-lint',
|
||||
\ ale#Escape('ember-template-lint') . ' --json --filename %s'
|
||||
|
||||
Execute(Runs the right command for ember-template-lint < 1.6):
|
||||
GivenCommandOutput ['1.5.0']
|
||||
|
||||
AssertLinter 'ember-template-lint',
|
||||
\ ale#Escape('ember-template-lint') . ' --json %t'
|
16
sources_non_forked/ale/test/linter/test_erb.vader
Normal file
16
sources_non_forked/ale/test/linter/test_erb.vader
Normal file
@ -0,0 +1,16 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('eruby', 'erb')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should not contain any filter code by default):
|
||||
call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/file.rb')
|
||||
|
||||
AssertLinter 'erb', 'erb -P -T - -x %t | ruby -c'
|
||||
|
||||
Execute(Executable should filter invalid eRuby when inside a Rails project):
|
||||
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb')
|
||||
|
||||
AssertLinter 'erb',
|
||||
\ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
26
sources_non_forked/ale/test/linter/test_erblint.vader
Normal file
26
sources_non_forked/ale/test/linter/test_erblint.vader
Normal file
@ -0,0 +1,26 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('eruby', 'erblint')
|
||||
call ale#test#SetFilename('dummy.html.erb')
|
||||
|
||||
let g:ale_eruby_erblint_executable = 'erblint'
|
||||
let g:ale_eruby_erblint_options = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to erblint):
|
||||
AssertLinter 'erblint', ale#Escape('erblint')
|
||||
\ . ' --format json --stdin %s'
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_eruby_erblint_executable = 'bin/erblint'
|
||||
|
||||
AssertLinter 'bin/erblint' , ale#Escape('bin/erblint')
|
||||
\ . ' --format json --stdin %s'
|
||||
|
||||
Execute(Setting bundle appends 'exec erblint'):
|
||||
let g:ale_eruby_erblint_executable = 'path to/bundle'
|
||||
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle')
|
||||
\ . ' exec erblint'
|
||||
\ . ' --format json --stdin %s'
|
@ -0,0 +1,45 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('erlang', 'dialyzer')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct.):
|
||||
AssertLinter 'dialyzer',
|
||||
\ ale#Escape('dialyzer')
|
||||
\ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt'))
|
||||
\ . ' -Wunmatched_returns'
|
||||
\ . ' -Werror_handling'
|
||||
\ . ' -Wrace_conditions'
|
||||
\ . ' -Wunderspecs'
|
||||
\ . ' %s'
|
||||
|
||||
Execute(The command should accept configured executable.):
|
||||
let b:ale_erlang_dialyzer_executable = '/usr/bin/dialyzer'
|
||||
AssertLinter '/usr/bin/dialyzer',
|
||||
\ ale#Escape('/usr/bin/dialyzer')
|
||||
\ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt'))
|
||||
\ . ' -Wunmatched_returns'
|
||||
\ . ' -Werror_handling'
|
||||
\ . ' -Wrace_conditions'
|
||||
\ . ' -Wunderspecs'
|
||||
\ . ' %s'
|
||||
|
||||
Execute(The command should accept configured options.):
|
||||
let b:ale_erlang_dialyzer_options = '-r ' . expand('$HOME')
|
||||
AssertLinter 'dialyzer',
|
||||
\ ale#Escape('dialyzer')
|
||||
\ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt'))
|
||||
\ . ' -r ' . expand('$HOME')
|
||||
\ . ' %s'
|
||||
|
||||
Execute(The command should accept configured PLT file.):
|
||||
let b:ale_erlang_dialyzer_plt_file = 'custom-plt'
|
||||
AssertLinter 'dialyzer',
|
||||
\ ale#Escape('dialyzer')
|
||||
\ . ' -n --plt ' . ale#Escape(expand('custom-plt'))
|
||||
\ . ' -Wunmatched_returns'
|
||||
\ . ' -Werror_handling'
|
||||
\ . ' -Wrace_conditions'
|
||||
\ . ' -Wunderspecs'
|
||||
\ . ' %s'
|
16
sources_non_forked/ale/test/linter/test_erlang_elvis.vader
Normal file
16
sources_non_forked/ale/test/linter/test_erlang_elvis.vader
Normal file
@ -0,0 +1,16 @@
|
||||
Before:
|
||||
let b:file = fnamemodify(bufname(''), ':.')
|
||||
call ale#assert#SetUpLinterTest('erlang', 'elvis')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Default command should be correct):
|
||||
AssertLinter 'elvis',
|
||||
\ ale#Escape('elvis') . ' rock --output-format=parsable ' . ale#Escape(b:file)
|
||||
|
||||
Execute(Executable should be configurable):
|
||||
let b:ale_erlang_elvis_executable = '/path/to/elvis'
|
||||
|
||||
AssertLinter '/path/to/elvis',
|
||||
\ ale#Escape('/path/to/elvis') . ' rock --output-format=parsable ' . ale#Escape(b:file)
|
62
sources_non_forked/ale/test/linter/test_erlang_erlc.vader
Normal file
62
sources_non_forked/ale/test/linter/test_erlang_erlc.vader
Normal file
@ -0,0 +1,62 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('erlang', 'erlc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct.):
|
||||
let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr(''))
|
||||
let g:regex = 'erlc.\+-o.\+%t'
|
||||
let g:matched = match(g:cmd, g:regex)
|
||||
|
||||
" match returns -1 if not found
|
||||
AssertNotEqual
|
||||
\ g:matched,
|
||||
\ -1,
|
||||
\ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']'
|
||||
|
||||
Execute(The command should accept configured executable.):
|
||||
let b:ale_erlang_erlc_executable = '/usr/bin/erlc'
|
||||
let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr(''))
|
||||
let g:regex = '/usr/bin/erlc.\+-o.\+%t'
|
||||
let g:matched = match(g:cmd, g:regex)
|
||||
|
||||
" match returns -1 if not found
|
||||
AssertNotEqual
|
||||
\ g:matched,
|
||||
\ -1,
|
||||
\ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']'
|
||||
|
||||
Execute(The command should accept configured options.):
|
||||
let b:ale_erlang_erlc_options = '-I include'
|
||||
let g:cmd = ale_linters#erlang#erlc#GetCommand(bufnr(''))
|
||||
let g:regex = 'erlc.\+-o.\+-I include.\+%t'
|
||||
let g:matched = match(g:cmd, g:regex)
|
||||
|
||||
" match returns -1 if not found
|
||||
AssertNotEqual
|
||||
\ g:matched,
|
||||
\ -1,
|
||||
\ 'Command error: expected [' . g:cmd . '] to match [' . g:regex . ']'
|
||||
|
||||
Execute(Linter should recognize OTP23 format.):
|
||||
let g:lines = ["t.erl:6: only association operators '=>' are allowed in map construction"]
|
||||
let g:output_text = ale_linters#erlang#erlc#Handle(bufnr(''), g:lines)[0].text
|
||||
|
||||
let g:expected = "only association operators '=>' are allowed in map construction"
|
||||
AssertEqual
|
||||
\ g:output_text,
|
||||
\ g:expected,
|
||||
\ 'Command error: expected [' . g:output_text . '] to match [' . g:expected . ']'
|
||||
|
||||
Execute(Linter should recognize OTP24 format.):
|
||||
let g:lines = ["t.erl:6:16: only association operators '=>' are allowed in map construction",
|
||||
\ "% 6| #{ a => A, b := B }.",
|
||||
\ "% | ^"]
|
||||
let g:output_text = ale_linters#erlang#erlc#Handle(bufnr(''), g:lines)[0].text
|
||||
|
||||
let g:expected = "only association operators '=>' are allowed in map construction"
|
||||
AssertEqual
|
||||
\ g:output_text,
|
||||
\ g:expected,
|
||||
\ 'Command error: expected [' . g:output_text . '] to match [' . g:expected . ']'
|
@ -0,0 +1,45 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('erlang', 'syntaxerl')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute (The default commands should be correct):
|
||||
AssertLinter 'syntaxerl', [
|
||||
\ ale#Escape('syntaxerl') . ' -h',
|
||||
\ ale#Escape('syntaxerl') . ' %t',
|
||||
\]
|
||||
|
||||
Execute (The executable should be configurable):
|
||||
let b:ale_erlang_syntaxerl_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', [
|
||||
\ ale#Escape('foobar') . ' -h',
|
||||
\ ale#Escape('foobar') . ' %t',
|
||||
\]
|
||||
|
||||
Execute (The -b option should be used when available):
|
||||
GivenCommandOutput [
|
||||
\ 'Syntax checker for Erlang (0.14.0)',
|
||||
\ 'Usage: syntaxerl [-d | --debug] <FILENAME>',
|
||||
\ ' syntaxerl <-h | --help>',
|
||||
\ ' -d, --debug Enable debug output',
|
||||
\ ' -h, --help Show this message',
|
||||
\]
|
||||
AssertLinter 'syntaxerl', [
|
||||
\ ale#Escape('syntaxerl') . ' -h',
|
||||
\ ale#Escape('syntaxerl') . ' %t',
|
||||
\]
|
||||
|
||||
GivenCommandOutput [
|
||||
\ 'Syntax checker for Erlang (0.14.0)',
|
||||
\ 'Usage: syntaxerl [-b | --base <FILENAME>] [-d | --debug] <FILENAME>',
|
||||
\ ' syntaxerl <-h | --help>',
|
||||
\ ' -b, --base Set original filename',
|
||||
\ ' -d, --debug Enable debug output',
|
||||
\ ' -h, --help Show this message',
|
||||
\]
|
||||
AssertLinter 'syntaxerl', [
|
||||
\ ale#Escape('syntaxerl') . ' -h',
|
||||
\ ale#Escape('syntaxerl') . ' -b %s %t',
|
||||
\]
|
32
sources_non_forked/ale/test/linter/test_erubi.vader
Normal file
32
sources_non_forked/ale/test/linter/test_erubi.vader
Normal file
@ -0,0 +1,32 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('eruby', 'erubi')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should not contain any filter code by default):
|
||||
call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/file.rb')
|
||||
|
||||
AssertLinter 'ruby', [
|
||||
\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'),
|
||||
\ 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c',
|
||||
\]
|
||||
|
||||
Execute(Executable should filter invalid eRuby when inside a Rails project):
|
||||
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb')
|
||||
|
||||
AssertLinter 'ruby', [
|
||||
\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'),
|
||||
\ 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c',
|
||||
\]
|
||||
|
||||
Execute(Command should be blank if the first command in the chain returns output):
|
||||
GivenCommandOutput [
|
||||
\ "/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erubi/capture_end (LoadError)",
|
||||
\ " from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'",
|
||||
\]
|
||||
|
||||
AssertLinter 'ruby', [
|
||||
\ 'ruby -r erubi/capture_end -e ' . ale#Escape('""'),
|
||||
\ '',
|
||||
\]
|
16
sources_non_forked/ale/test/linter/test_erubis.vader
Normal file
16
sources_non_forked/ale/test/linter/test_erubis.vader
Normal file
@ -0,0 +1,16 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('eruby', 'erubis')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should not contain any filter code by default):
|
||||
call ale#test#SetFilename('../test-files/ruby/not_a_rails_app/file.rb')
|
||||
|
||||
AssertLinter 'erubis', 'erubis -x %t | ruby -c'
|
||||
|
||||
Execute(Executable should filter invalid eRuby when inside a Rails project):
|
||||
call ale#test#SetFilename('../test-files/ruby/valid_rails_app/app/views/my_great_view.html.erb')
|
||||
|
||||
AssertLinter 'erubis',
|
||||
\ 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c'
|
85
sources_non_forked/ale/test/linter/test_eslint.vader
Normal file
85
sources_non_forked/ale/test/linter/test_eslint.vader
Normal file
@ -0,0 +1,85 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('javascript', 'eslint')
|
||||
runtime autoload/ale/handlers/eslint.vim
|
||||
|
||||
let b:args = ' -f json --stdin --stdin-filename %s'
|
||||
|
||||
After:
|
||||
unlet! b:args
|
||||
unlet! b:executable
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinterCwd ''
|
||||
AssertLinter 'eslint', ale#Escape('eslint') . b:args
|
||||
|
||||
Execute(create-react-app directories should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
|
||||
AssertLinter b:executable,
|
||||
\ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
|
||||
\ . ale#Escape(b:executable) . b:args
|
||||
|
||||
Execute(use-global should override create-react-app detection):
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
|
||||
|
||||
let g:ale_javascript_eslint_use_global = 1
|
||||
let g:ale_javascript_eslint_executable = 'eslint_d'
|
||||
|
||||
let b:executable = 'eslint_d'
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . b:args
|
||||
|
||||
Execute(other app directories should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/node_modules/.bin/eslint')
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint')
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . b:args
|
||||
|
||||
Execute(use-global should override other app directories):
|
||||
call ale#test#SetFilename('../test-files/eslint/other-app/subdir/testfile.js')
|
||||
|
||||
let g:ale_javascript_eslint_use_global = 1
|
||||
let g:ale_javascript_eslint_executable = 'eslint_d'
|
||||
|
||||
let b:executable = 'eslint_d'
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint')
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . b:args
|
||||
|
||||
Execute(eslint_d should be detected correctly):
|
||||
call ale#test#SetFilename('../test-files/eslint/app-with-eslint-d/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d/node_modules/.bin/eslint_d')
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/app-with-eslint-d')
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . b:args
|
||||
|
||||
Execute(eslint.js executables should be run with node on Windows):
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
|
||||
AssertLinter b:executable,
|
||||
\ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
|
||||
\ . ale#Escape(b:executable) . b:args
|
||||
|
||||
Execute(eslint.js should be run from a containing project with node_modules):
|
||||
call ale#test#SetFilename('../test-files/eslint/react-app/subdir-with-package-json/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/eslint/bin/eslint.js')
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/react-app')
|
||||
AssertLinter b:executable,
|
||||
\ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
|
||||
\ . ale#Escape(b:executable) . b:args
|
||||
|
||||
Execute(eslint.js should be run from a containing project with .yarn/sdks):
|
||||
call ale#test#SetFilename('../test-files/eslint/yarn2-app/subdir/testfile.js')
|
||||
|
||||
let b:executable = ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app/.yarn/sdks/eslint/bin/eslint.js')
|
||||
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/eslint/yarn2-app')
|
||||
AssertLinter b:executable,
|
||||
\ (has('win32') ? ale#Escape('node.exe') . ' ' : '')
|
||||
\ . ale#Escape(b:executable) . b:args
|
9
sources_non_forked/ale/test/linter/test_fecs.vader
Normal file
9
sources_non_forked/ale/test/linter/test_fecs.vader
Normal file
@ -0,0 +1,9 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('javascript', 'fecs')
|
||||
runtime autoload/ale/handlers/fecs.vim
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'fecs', ale#Escape('fecs') . ' check --colors=false --rule=true %t'
|
219
sources_non_forked/ale/test/linter/test_flake8.vader
Normal file
219
sources_non_forked/ale/test/linter/test_flake8.vader
Normal file
@ -0,0 +1,219 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('python', 'flake8')
|
||||
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
GivenCommandOutput ['3.0.0']
|
||||
|
||||
After:
|
||||
unlet! b:executable
|
||||
unlet! b:bin_dir
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The flake8 callbacks should return the correct default values):
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
" The version check should be cached.
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
" Try with older versions.
|
||||
call ale#semver#ResetVersionCache()
|
||||
GivenCommandOutput ['2.9.9']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --format=default -',
|
||||
\]
|
||||
|
||||
Execute(The option for disabling changing directories should work):
|
||||
let g:ale_python_flake8_change_directory = 'off'
|
||||
|
||||
AssertLinterCwd ['', '']
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
let g:ale_python_flake8_change_directory = 0
|
||||
|
||||
AssertLinterCwd ['']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
" Invalid options should be considered the same as turning the setting off.
|
||||
let g:ale_python_flake8_change_directory = 'xxx'
|
||||
|
||||
AssertLinterCwd ['']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The option for changing directory to project root should work):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
|
||||
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The option for changing directory to file dir should work):
|
||||
let g:ale_python_flake8_change_directory = 'file'
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
|
||||
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
let g:ale_python_flake8_change_directory = 1
|
||||
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The flake8 command callback should let you set options):
|
||||
let g:ale_python_flake8_options = '--some-option'
|
||||
|
||||
GivenCommandOutput ['3.0.4']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --some-option'
|
||||
\ . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
call ale#semver#ResetVersionCache()
|
||||
GivenCommandOutput ['2.9.9']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --some-option --format=default -',
|
||||
\]
|
||||
|
||||
Execute(You should be able to set a custom executable and it should be escaped):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
let g:ale_python_flake8_executable = 'executable with spaces'
|
||||
|
||||
AssertLinterCwd ['%s:h', '%s:h']
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'executable with spaces', [
|
||||
\ ale#Escape('executable with spaces') . ' --version',
|
||||
\ ale#Escape('executable with spaces')
|
||||
\ . ' --format=default'
|
||||
\ . ' --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The flake8 callbacks should detect virtualenv directories):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/flake8'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, [
|
||||
\ ale#Escape(b:executable) . ' --version',
|
||||
\ ale#Escape(b:executable)
|
||||
\ . ' --format=default'
|
||||
\ . ' --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for non-namespace package):
|
||||
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
" Some users currently run flake8 this way, so we should support it.
|
||||
Execute(Using `python -m flake8` should be supported for running flake8):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let g:ale_python_flake8_executable = 'python'
|
||||
let g:ale_python_flake8_options = '-m flake8 --some-option'
|
||||
|
||||
GivenCommandOutput ['2.9.9']
|
||||
AssertLinter 'python', [
|
||||
\ ale#Escape('python') . ' -m flake8 --version',
|
||||
\ ale#Escape('python')
|
||||
\ . ' -m flake8 --some-option --format=default -'
|
||||
\]
|
||||
|
||||
call ale#semver#ResetVersionCache()
|
||||
|
||||
" Leading spaces shouldn't matter
|
||||
let g:ale_python_flake8_options = ' -m flake8 --some-option'
|
||||
|
||||
GivenCommandOutput ['2.9.9']
|
||||
AssertLinter 'python', [
|
||||
\ ale#Escape('python') . ' -m flake8 --version',
|
||||
\ ale#Escape('python')
|
||||
\ . ' -m flake8 --some-option --format=default -'
|
||||
\]
|
||||
|
||||
Execute(Setting executable to 'pipenv' should append 'run flake8'):
|
||||
let g:ale_python_flake8_executable = 'path/to/pipenv'
|
||||
|
||||
" FIXME: pipenv should check the version with flake8.
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#Escape('path/to/pipenv') . ' run flake8 --format=default -'
|
||||
|
||||
Execute(Pipenv is detected when python_flake8_auto_pipenv is set):
|
||||
let g:ale_python_flake8_auto_pipenv = 1
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#Escape('pipenv') . ' run flake8 --format=default --stdin-display-name %s -'
|
||||
|
||||
Execute(Setting executable to 'poetry' should append 'run flake8'):
|
||||
let g:ale_python_flake8_executable = 'path/to/poetry'
|
||||
|
||||
" FIXME: poetry should check the version with flake8.
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'path/to/poetry',
|
||||
\ ale#Escape('path/to/poetry') . ' run flake8 --format=default -'
|
||||
|
||||
Execute(poetry is detected when python_flake8_auto_poetry is set):
|
||||
let g:ale_python_flake8_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run flake8 --format=default --stdin-display-name %s -'
|
203
sources_non_forked/ale/test/linter/test_flakehell.vader
Normal file
203
sources_non_forked/ale/test/linter/test_flakehell.vader
Normal file
@ -0,0 +1,203 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('python', 'flakehell')
|
||||
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
GivenCommandOutput ['0.8.0']
|
||||
|
||||
After:
|
||||
unlet! b:executable
|
||||
unlet! b:bin_dir
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The flakehell callbacks should return the correct default values):
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' --version',
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
" The version check should be cached.
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The option for disabling changing directories should work):
|
||||
let g:ale_python_flakehell_change_directory = 'off'
|
||||
|
||||
AssertLinterCwd ['', '']
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' --version',
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
let g:ale_python_flakehell_change_directory = 0
|
||||
|
||||
AssertLinterCwd ['']
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
" Invalid options should be considered the same as turning the setting off.
|
||||
let g:ale_python_flakehell_change_directory = 'xxx'
|
||||
|
||||
AssertLinterCwd ['']
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The option for changing directory to project root should work):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
|
||||
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' --version',
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The option for changing directory to file dir should work):
|
||||
let g:ale_python_flakehell_change_directory = 'file'
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
|
||||
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' --version',
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
let g:ale_python_flakehell_change_directory = 1
|
||||
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' lint --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The flakehell command callback should let you set options):
|
||||
let g:ale_python_flakehell_options = '--some-option'
|
||||
|
||||
GivenCommandOutput ['0.8.0']
|
||||
AssertLinter 'flakehell', [
|
||||
\ ale#Escape('flakehell') . ' --version',
|
||||
\ ale#Escape('flakehell') . ' lint --some-option'
|
||||
\ . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(You should be able to set a custom executable and it should be escaped):
|
||||
let g:ale_python_flakehell_executable = 'executable with spaces'
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
AssertLinterCwd ['%s:h', '%s:h']
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertLinter 'executable with spaces', [
|
||||
\ ale#Escape('executable with spaces') . ' --version',
|
||||
\ ale#Escape('executable with spaces')
|
||||
\ . ' lint'
|
||||
\ . ' --format=default'
|
||||
\ . ' --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The flakehell callbacks should detect virtualenv directories):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/flakehell'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, [
|
||||
\ ale#Escape(b:executable) . ' --version',
|
||||
\ ale#Escape(b:executable)
|
||||
\ . ' lint'
|
||||
\ . ' --format=default'
|
||||
\ . ' --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini):
|
||||
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
Execute(The FindProjectRoot should detect the project root directory for non-namespace package):
|
||||
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'),
|
||||
\ ale#python#FindProjectRoot(bufnr(''))
|
||||
|
||||
" Some users currently run flakehell this way, so we should support it.
|
||||
Execute(Using `python -m flakehell` should be supported for running flakehell):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let g:ale_python_flakehell_executable = 'python'
|
||||
let g:ale_python_flakehell_options = '--some-option'
|
||||
|
||||
AssertLinter 'python', [
|
||||
\ ale#Escape('python') . ' -m flakehell --version',
|
||||
\ ale#Escape('python')
|
||||
\ . ' -m flakehell lint --some-option --format=default --stdin-display-name %s -'
|
||||
\]
|
||||
|
||||
call ale#semver#ResetVersionCache()
|
||||
|
||||
" Leading spaces shouldn't matter
|
||||
let g:ale_python_flakehell_options = ' --some-option'
|
||||
|
||||
AssertLinter 'python', [
|
||||
\ ale#Escape('python') . ' -m flakehell --version',
|
||||
\ ale#Escape('python')
|
||||
\ . ' -m flakehell lint --some-option --format=default --stdin-display-name %s -'
|
||||
\]
|
||||
|
||||
Execute(Setting executable to 'pipenv' should append 'run flakehell'):
|
||||
let g:ale_python_flakehell_executable = 'path/to/pipenv'
|
||||
|
||||
" FIXME: pipenv should check the version with flakehell.
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#Escape('path/to/pipenv') . ' run flakehell lint --format=default -'
|
||||
|
||||
Execute(Pipenv is detected when python_flakehell_auto_pipenv is set):
|
||||
let g:ale_python_flakehell_auto_pipenv = 1
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#Escape('pipenv') . ' run flakehell lint --format=default --stdin-display-name %s -'
|
||||
|
||||
Execute(Setting executable to 'poetry' should append 'run flakehell'):
|
||||
let g:ale_python_flakehell_executable = 'path/to/poetry'
|
||||
|
||||
" FIXME: poetry should check the version with flakehell.
|
||||
GivenCommandOutput []
|
||||
AssertLinter 'path/to/poetry',
|
||||
\ ale#Escape('path/to/poetry') . ' run flakehell lint --format=default -'
|
||||
|
||||
Execute(poetry is detected when python_flakehell_auto_poetry is set):
|
||||
let g:ale_python_flakehell_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinterCwd ale#python#FindProjectRootIni(bufnr(''))
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run flakehell lint --format=default --stdin-display-name %s -'
|
42
sources_non_forked/ale/test/linter/test_flow.vader
Normal file
42
sources_non_forked/ale/test/linter/test_flow.vader
Normal file
@ -0,0 +1,42 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('javascript', 'flow')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(flow should return a command to run if a .flowconfig file exists):
|
||||
call ale#test#SetFilename('../test-files/flow/a/sub/dummy')
|
||||
|
||||
AssertLinter 'flow',
|
||||
\ ale#Escape('flow')
|
||||
\ . ' check-contents --respect-pragma --json --from ale %s < %t'
|
||||
\ . (!has('win32') ? '; echo' : '')
|
||||
|
||||
Execute(flow should not use the respect pragma argument if the option is off):
|
||||
call ale#test#SetFilename('../test-files/flow/a/sub/dummy')
|
||||
|
||||
let b:ale_javascript_flow_use_respect_pragma = 0
|
||||
|
||||
AssertLinter 'flow',
|
||||
\ ale#Escape('flow')
|
||||
\ . ' check-contents --json --from ale %s < %t'
|
||||
\ . (!has('win32') ? '; echo' : '')
|
||||
|
||||
Execute(flow should should not use --respect-pragma for old versions):
|
||||
call ale#test#SetFilename('../test-files/flow/a/sub/dummy')
|
||||
|
||||
GivenCommandOutput [
|
||||
\ 'Warning: `flow --version` is deprecated in favor of `flow version`',
|
||||
\ 'Flow, a static type checker for JavaScript, version 0.27.0',
|
||||
\]
|
||||
AssertLinter 'flow', [
|
||||
\ ale#Escape('flow') . ' --version',
|
||||
\ ale#Escape('flow')
|
||||
\ . ' check-contents --json --from ale %s < %t'
|
||||
\ . (!has('win32') ? '; echo' : ''),
|
||||
\]
|
||||
|
||||
Execute(flow should not return a command to run if no .flowconfig file exists):
|
||||
call ale#test#SetFilename('../test-files/flow/b/sub/dummy')
|
||||
|
||||
AssertLinterNotExecuted
|
18
sources_non_forked/ale/test/linter/test_foodcritic.vader
Normal file
18
sources_non_forked/ale/test/linter/test_foodcritic.vader
Normal file
@ -0,0 +1,18 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('chef', 'foodcritic')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' %s'
|
||||
|
||||
Execute(Extra options should be included with escapeed tildes (~)):
|
||||
let b:ale_chef_foodcritic_options = '-t ~F011'
|
||||
|
||||
AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' -t \~F011 %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_chef_foodcritic_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
18
sources_non_forked/ale/test/linter/test_fortran_fortls.vader
Normal file
18
sources_non_forked/ale/test/linter/test_fortran_fortls.vader
Normal file
@ -0,0 +1,18 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('fortran', 'language_server')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path should be correct):
|
||||
AssertLinter 'fortls', ale#Escape('fortls')
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('../test-files/fortls-project/test.F90')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/fortls-project')
|
||||
|
||||
Execute(The language should be correct):
|
||||
AssertLSPLanguage 'fortran'
|
13
sources_non_forked/ale/test/linter/test_fsc.vader
Normal file
13
sources_non_forked/ale/test/linter/test_fsc.vader
Normal file
@ -0,0 +1,13 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('scala', 'fsc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Given scala(An empty Scala file):
|
||||
Execute(The default executable and command should be correct):
|
||||
AssertLinter 'fsc', ale#Escape('fsc') . ' -Ystop-after:parser %t'
|
||||
|
||||
Given scala.sbt(An empty SBT file):
|
||||
Execute(fsc should not be run for sbt files):
|
||||
AssertLinterNotExecuted
|
19
sources_non_forked/ale/test/linter/test_fusionlint.vader
Normal file
19
sources_non_forked/ale/test/linter/test_fusionlint.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('fuse', 'fusionlint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The fuse fusionlint command callback should return the correct default string):
|
||||
AssertLinter 'fusion-lint', ale#Escape('fusion-lint') . ' --filename %s -i'
|
||||
|
||||
Execute(The fuse fusionlint command callback should let you set options):
|
||||
let g:ale_fuse_fusionlint_options = '--example-option argument'
|
||||
|
||||
AssertLinter 'fusion-lint',
|
||||
\ ale#Escape('fusion-lint') . ' --example-option argument --filename %s -i'
|
||||
|
||||
Execute(The fusionlint executable should be configurable):
|
||||
let g:ale_fuse_fusionlint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --filename %s -i'
|
25
sources_non_forked/ale/test/linter/test_gawk.vader
Normal file
25
sources_non_forked/ale/test/linter/test_gawk.vader
Normal file
@ -0,0 +1,25 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('awk', 'gawk')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'gawk',
|
||||
\ ale#Escape('gawk') . ' --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ' --lint -f %t /dev/null'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_awk_gawk_executable = '/other/gawk'
|
||||
|
||||
AssertLinter '/other/gawk',
|
||||
\ ale#Escape('/other/gawk') . ' --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ' --lint -f %t /dev/null'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_awk_gawk_executable = 'gawk'
|
||||
let b:ale_awk_gawk_options = '--lint=no-ext'
|
||||
|
||||
AssertLinter 'gawk',
|
||||
\ ale#Escape('gawk') . ' --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ' --lint --lint=no-ext -f %t /dev/null'
|
24
sources_non_forked/ale/test/linter/test_gfortran.vader
Normal file
24
sources_non_forked/ale/test/linter/test_gfortran.vader
Normal file
@ -0,0 +1,24 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('fortran', 'gcc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The fortran gcc command callback should return the correct default string):
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -'
|
||||
|
||||
Execute(The fortran gcc command callback should let you set options):
|
||||
let g:ale_fortran_gcc_options = '-Wotherthings'
|
||||
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffree-form -Wotherthings -'
|
||||
|
||||
Execute(The fortran gcc command callback should let you use -ffixed-form):
|
||||
let g:ale_fortran_gcc_use_free_form = 0
|
||||
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . ' -S -x f95 -fsyntax-only -ffixed-form -Wall -'
|
||||
|
||||
Execute(The fortran executable should be configurable):
|
||||
let g:ale_fortran_gcc_executable = 'gfortran'
|
||||
|
||||
AssertLinter 'gfortran',
|
||||
\ ale#Escape('gfortran') . ' -S -x f95 -fsyntax-only -ffree-form -Wall -'
|
19
sources_non_forked/ale/test/linter/test_ghdl.vader
Normal file
19
sources_non_forked/ale/test/linter/test_ghdl.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('vhdl', 'ghdl')
|
||||
|
||||
After:
|
||||
unlet! b:command_tail
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertLinter 'ghdl', ale#Escape('ghdl') . ' -s --std=08 %t'
|
||||
|
||||
let b:ale_vhdl_ghdl_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' -s --std=08 %t'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_vhdl_ghdl_options = '--something'
|
||||
|
||||
AssertLinter 'ghdl', ale#Escape('ghdl') . ' -s --something %t'
|
43
sources_non_forked/ale/test/linter/test_gitlint.vader
Normal file
43
sources_non_forked/ale/test/linter/test_gitlint.vader
Normal file
@ -0,0 +1,43 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('gitcommit', 'gitlint')
|
||||
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
After:
|
||||
unlet! b:bin_dir
|
||||
unlet! b:executable
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The gitlint callbacks should return the correct default values):
|
||||
AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint'
|
||||
|
||||
Execute(The gitlint executable should be configurable, and escaped properly):
|
||||
let g:ale_gitcommit_gitlint_executable = 'executable with spaces'
|
||||
|
||||
AssertLinter 'executable with spaces',
|
||||
\ ale#Escape('executable with spaces') . ' lint'
|
||||
|
||||
Execute(The gitlint command callback should let you set options):
|
||||
let g:ale_gitcommit_gitlint_options = '--some-option'
|
||||
|
||||
AssertLinter 'gitlint', ale#Escape('gitlint') . ' --some-option lint'
|
||||
|
||||
Execute(The gitlint callbacks shouldn't detect virtualenv directories where they don't exist):
|
||||
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
|
||||
AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint'
|
||||
|
||||
Execute(The gitlint callbacks should detect virtualenv directories):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/gitlint'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' lint'
|
||||
|
||||
Execute(You should able able to use the global gitlint instead):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
let g:ale_gitcommit_gitlint_use_global = 1
|
||||
|
||||
AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint'
|
19
sources_non_forked/ale/test/linter/test_glslang.vader
Normal file
19
sources_non_forked/ale/test/linter/test_glslang.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('glsl', 'glslang')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'glslangValidator', ale#Escape('glslangValidator') . ' -C %t'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_glsl_glslang_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' -C %t'
|
||||
|
||||
Execute(Options should work):
|
||||
let g:ale_glsl_glslang_options = '--test'
|
||||
|
||||
AssertLinter 'glslangValidator',
|
||||
\ ale#Escape('glslangValidator') . ' --test -C %t'
|
19
sources_non_forked/ale/test/linter/test_glslls.vader
Normal file
19
sources_non_forked/ale/test/linter/test_glslls.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('glsl', 'glslls')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'glslls', ale#Escape('glslls') . ' --stdin'
|
||||
|
||||
Execute(Executable should be configurable):
|
||||
let b:ale_glsl_glslls_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin'
|
||||
|
||||
Execute(Setting logfile should work):
|
||||
let b:ale_glsl_glslls_logfile = '/tmp/test.log'
|
||||
|
||||
AssertLinter 'glslls',
|
||||
\ ale#Escape('glslls') . ' --verbose -l /tmp/test.log --stdin'
|
33
sources_non_forked/ale/test/linter/test_gobuild.vader
Normal file
33
sources_non_forked/ale/test/linter/test_gobuild.vader
Normal file
@ -0,0 +1,33 @@
|
||||
Before:
|
||||
Save g:ale_go_go_executable
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gobuild')
|
||||
|
||||
GivenCommandOutput ['/foo/bar', '/foo/baz']
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinterCwd '%s:h'
|
||||
AssertLinter 'go', 'go test -c -o /dev/null ./'
|
||||
|
||||
Execute(Go environment variables should be supported):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go test -c -o /dev/null ./'
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
Execute(Extra options should be supported):
|
||||
let g:ale_go_gobuild_options = '--foo-bar'
|
||||
|
||||
AssertLinter 'go', 'go test --foo-bar -c -o /dev/null ./'
|
||||
|
||||
let g:ale_go_gobuild_options = ''
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_go_go_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', 'foobar test -c -o /dev/null ./'
|
26
sources_non_forked/ale/test/linter/test_gofmt.vader
Normal file
26
sources_non_forked/ale/test/linter/test_gofmt.vader
Normal file
@ -0,0 +1,26 @@
|
||||
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('../test-files/go/testfile2.go')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default gofmt command should be correct):
|
||||
AssertLinter 'gofmt',
|
||||
\ ale#Escape('gofmt') . ' -e %t'
|
||||
|
||||
Execute(The gofmt command should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'gofmt',
|
||||
\ ale#Env('GO111MODULE', 'on')
|
||||
\ . ale#Escape('gofmt') . ' -e %t'
|
50
sources_non_forked/ale/test/linter/test_golangci_lint.vader
Normal file
50
sources_non_forked/ale/test/linter/test_golangci_lint.vader
Normal file
@ -0,0 +1,50 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'golangci_lint')
|
||||
call ale#test#SetFilename('test.go')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The golangci-lint defaults should be correct):
|
||||
AssertLinterCwd '%s:h',
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#Escape('golangci-lint')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
\ . ' --enable-all'
|
||||
|
||||
Execute(The golangci-lint callback should use a configured executable):
|
||||
let b:ale_go_golangci_lint_executable = 'something else'
|
||||
|
||||
AssertLinter 'something else',
|
||||
\ ale#Escape('something else')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
\ . ' --enable-all'
|
||||
|
||||
Execute(The golangci-lint callback should use configured options):
|
||||
let b:ale_go_golangci_lint_options = '--foobar'
|
||||
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#Escape('golangci-lint')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
\ . ' --foobar'
|
||||
|
||||
Execute(The golangci-lint callback should support environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#Env('GO111MODULE', 'on')
|
||||
\ . ale#Escape('golangci-lint')
|
||||
\ . ' run ' . ale#Escape(expand('%' . ':t'))
|
||||
\ . ' --enable-all'
|
||||
|
||||
Execute(The golangci-lint `lint_package` option should use the correct command):
|
||||
let b:ale_go_golangci_lint_package = 1
|
||||
|
||||
AssertLinter 'golangci-lint',
|
||||
\ ale#Escape('golangci-lint') . ' run --enable-all'
|
76
sources_non_forked/ale/test/linter/test_golangserver.vader
Normal file
76
sources_non_forked/ale/test/linter/test_golangserver.vader
Normal file
@ -0,0 +1,76 @@
|
||||
Before:
|
||||
Save $GOPATH
|
||||
Save g:ale_completion_enabled
|
||||
Save g:ale_go_go111module
|
||||
|
||||
let g:ale_completion_enabled = 0
|
||||
let g:sep = has('win32') ? ';' : ':'
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'langserver')
|
||||
let $GOPATH = ale#path#Simplify(g:dir . '/../test-files/go/go1')
|
||||
\ . g:sep
|
||||
\ . ale#path#Simplify(g:dir . '/../test-files/go/go2')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_completion_enabled
|
||||
unlet! b:ale_go_go111module
|
||||
unlet! g:sep
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(should set correct defaults):
|
||||
AssertLinter 'go-langserver', ale#Escape('go-langserver')
|
||||
|
||||
Execute(should configure go-langserver callback executable):
|
||||
let b:ale_go_langserver_executable = 'boo'
|
||||
|
||||
AssertLinter 'boo', ale#Escape('boo')
|
||||
|
||||
Execute(should set go-langserver options):
|
||||
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
||||
let b:ale_completion_enabled = 1
|
||||
let b:ale_go_langserver_options = ''
|
||||
|
||||
AssertLinter 'go-langserver',
|
||||
\ ale#Escape('go-langserver') . ' -gocodecompletion'
|
||||
|
||||
let b:ale_go_langserver_options = '-trace'
|
||||
|
||||
AssertLinter 'go-langserver',
|
||||
\ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
|
||||
|
||||
Execute(should ignore go-langserver -gocodecompletion option):
|
||||
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
||||
|
||||
let b:ale_go_langserver_options = '-trace -gocodecompletion'
|
||||
let b:ale_completion_enabled = 1
|
||||
|
||||
AssertLinter 'go-langserver',
|
||||
\ ale#Escape('go-langserver') . ' -gocodecompletion -trace'
|
||||
|
||||
let b:ale_completion_enabled = 0
|
||||
|
||||
AssertLinter 'go-langserver', ale#Escape('go-langserver') . ' -trace'
|
||||
|
||||
Execute(should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'go-langserver',
|
||||
\ ale#Env('GO111MODULE', 'on') . ale#Escape('go-langserver')
|
||||
|
||||
Execute(should set go-langserver for go app1):
|
||||
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
||||
|
||||
AssertLSPLanguage 'go'
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go/go1')
|
||||
|
||||
Execute(should set go-langserver for go app2):
|
||||
call ale#test#SetFilename('../test-files/go/go2/prj1/file.go')
|
||||
|
||||
AssertLSPLanguage 'go'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPConfig {}
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go/go2')
|
30
sources_non_forked/ale/test/linter/test_golint.vader
Normal file
30
sources_non_forked/ale/test/linter/test_golint.vader
Normal file
@ -0,0 +1,30 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'golint')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default golint command should be correct):
|
||||
AssertLinter 'golint', ale#Escape('golint') . ' %t'
|
||||
|
||||
Execute(The golint executable should be configurable):
|
||||
let b:ale_go_golint_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %t'
|
||||
|
||||
Execute(The golint options should be configurable):
|
||||
let b:ale_go_golint_options = '--foo'
|
||||
|
||||
AssertLinter 'golint', ale#Escape('golint') . ' --foo %t'
|
||||
|
||||
Execute(The golint command should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'golint',
|
||||
\ ale#Env('GO111MODULE', 'on') . ale#Escape('golint') . ' %t'
|
49
sources_non_forked/ale/test/linter/test_gometalinter.vader
Normal file
49
sources_non_forked/ale/test/linter/test_gometalinter.vader
Normal file
@ -0,0 +1,49 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gometalinter')
|
||||
call ale#test#SetFilename('test.go')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The gometalinter defaults should be correct):
|
||||
AssertLinterCwd '%s:h',
|
||||
AssertLinter 'gometalinter',
|
||||
\ ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' .'
|
||||
|
||||
Execute(The gometalinter callback should use a configured executable):
|
||||
let b:ale_go_gometalinter_executable = 'something else'
|
||||
|
||||
AssertLinter 'something else',
|
||||
\ ale#Escape('something else')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' .'
|
||||
|
||||
Execute(The gometalinter callback should use configured options):
|
||||
let b:ale_go_gometalinter_options = '--foobar'
|
||||
|
||||
AssertLinter 'gometalinter',
|
||||
\ ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' --foobar' . ' .'
|
||||
|
||||
Execute(The gometalinter should use configured environment variables):
|
||||
let b:ale_go_go111module = 'off'
|
||||
|
||||
AssertLinter 'gometalinter',
|
||||
\ ale#Env('GO111MODULE', 'off')
|
||||
\ . ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' .'
|
||||
|
||||
Execute(The gometalinter `lint_package` option should use the correct command):
|
||||
let b:ale_go_gometalinter_lint_package = 1
|
||||
|
||||
AssertLinter 'gometalinter', ale#Escape('gometalinter') . ' .'
|
96
sources_non_forked/ale/test/linter/test_gopls.vader
Normal file
96
sources_non_forked/ale/test/linter/test_gopls.vader
Normal file
@ -0,0 +1,96 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
Save $GOPATH
|
||||
|
||||
let $GOPATH = '/non/existent/directory'
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gopls')
|
||||
|
||||
After:
|
||||
if isdirectory(g:dir . '/.git')
|
||||
call delete(g:dir . '/.git', 'd')
|
||||
endif
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
unlet! b:ale_go_go111module
|
||||
unlet! b:ale_completion_enabled
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'gopls', ale#Escape('gopls') . ' --mode stdio'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_go_gopls_executable = 'boo'
|
||||
|
||||
AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio'
|
||||
|
||||
Execute(gopls should be found in GOPATH):
|
||||
" This is a directory with a fake executable
|
||||
let $GOPATH = ale#test#GetFilename('../test-files/go/gopath')
|
||||
|
||||
AssertLinter
|
||||
\ ale#test#GetFilename('../test-files/go/gopath/bin/gopls'),
|
||||
\ ale#Escape(ale#test#GetFilename('../test-files/go/gopath/bin/gopls'))
|
||||
\ . ' --mode stdio'
|
||||
|
||||
Execute(Global settings should be preferre for gopls if use_global = 1):
|
||||
" This is a directory with a fake executable
|
||||
let $GOPATH = ale#test#GetFilename('../test-files/go/gopath')
|
||||
let b:ale_go_gopls_executable = 'boo'
|
||||
let b:ale_go_gopls_use_global = 1
|
||||
|
||||
AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio'
|
||||
|
||||
Execute(Settings options should work):
|
||||
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
||||
" let b:ale_completion_enabled = 1
|
||||
let b:ale_go_gopls_options = ''
|
||||
|
||||
AssertLinter 'gopls',
|
||||
\ ale#Escape('gopls') . ''
|
||||
|
||||
let b:ale_go_gopls_options = '--mode stdio --trace'
|
||||
|
||||
AssertLinter 'gopls',
|
||||
\ ale#Escape('gopls') . ' --mode stdio --trace'
|
||||
|
||||
let b:ale_go_gopls_init_options = {'ui.diagnostic.analyses': {'composites': v:false}}
|
||||
AssertLSPOptions {'ui.diagnostic.analyses': {'composites': v:false}}
|
||||
|
||||
Execute(Go environment variables should be passed on):
|
||||
let b:ale_go_go111module = 'off'
|
||||
|
||||
AssertLinter 'gopls',
|
||||
\ ale#Env('GO111MODULE', 'off') . ale#Escape('gopls') . ' --mode stdio'
|
||||
|
||||
Execute(Project directories should be detected based on 'go.mod' being present):
|
||||
call ale#test#SetFilename('../test-files/go/test.go')
|
||||
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go')
|
||||
|
||||
Execute(Project directories with .git should be detected):
|
||||
call ale#test#SetFilename('test.go')
|
||||
|
||||
if !isdirectory(g:dir . '/.git')
|
||||
call mkdir(g:dir . '/.git')
|
||||
endif
|
||||
|
||||
AssertLSPProject g:dir
|
||||
|
||||
Execute('go.mod' should be ignored if modules are off):
|
||||
call ale#test#SetFilename('../test-files/go/test.go')
|
||||
|
||||
let b:ale_go_go111module = 'off'
|
||||
let b:parent_dir = ale#path#Simplify(g:dir . '/..')
|
||||
let b:git_dir = b:parent_dir . '/.git'
|
||||
|
||||
if !isdirectory(b:git_dir)
|
||||
call mkdir(b:git_dir)
|
||||
endif
|
||||
|
||||
AssertLSPProject b:parent_dir
|
||||
|
||||
call delete(b:git_dir, 'd')
|
||||
unlet! b:parent_dir
|
||||
unlet! b:git_dir
|
19
sources_non_forked/ale/test/linter/test_gosimple.vader
Normal file
19
sources_non_forked/ale/test/linter/test_gosimple.vader
Normal file
@ -0,0 +1,19 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gosimple')
|
||||
call ale#test#SetFilename('../test-files/go/testfile2.go')
|
||||
|
||||
After:
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default gosimple command should be correct):
|
||||
AssertLinterCwd '%s:h'
|
||||
AssertLinter 'gosimple', 'gosimple .'
|
||||
|
||||
Execute(The gosimple command should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'gosimple', ale#Env('GO111MODULE', 'on') . 'gosimple .'
|
24
sources_non_forked/ale/test/linter/test_gotype.vader
Normal file
24
sources_non_forked/ale/test/linter/test_gotype.vader
Normal file
@ -0,0 +1,24 @@
|
||||
Before:
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gotype')
|
||||
call ale#test#SetFilename('../test-files/go/testfile2.go')
|
||||
|
||||
After:
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default gotype command should be correct):
|
||||
AssertLinterCwd '%s:h'
|
||||
AssertLinter 'gotype', 'gotype -e .'
|
||||
|
||||
Execute(The gotype callback should ignore test files):
|
||||
call ale#test#SetFilename('bla_test.go')
|
||||
|
||||
AssertLinterNotExecuted
|
||||
|
||||
Execute(The gotype callback should support Go environment variables):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'gotype', ale#Env('GO111MODULE', 'on') . 'gotype -e .'
|
32
sources_non_forked/ale/test/linter/test_govet.vader
Normal file
32
sources_non_forked/ale/test/linter/test_govet.vader
Normal file
@ -0,0 +1,32 @@
|
||||
Before:
|
||||
Save g:ale_go_go_executable
|
||||
Save g:ale_go_govet_options
|
||||
Save g:ale_go_go111module
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'govet')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_go_go111module
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'go', 'go vet .'
|
||||
|
||||
Execute(Extra options should be supported):
|
||||
let g:ale_go_govet_options = '--foo-bar'
|
||||
|
||||
AssertLinterCwd '%s:h'
|
||||
AssertLinter 'go', 'go vet --foo-bar .'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_go_go_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', 'foobar vet .'
|
||||
|
||||
Execute(Go environment variables should be supported):
|
||||
let b:ale_go_go111module = 'on'
|
||||
|
||||
AssertLinter 'go', ale#Env('GO111MODULE', 'on') . 'go vet .'
|
@ -0,0 +1,9 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('graphql', 'gqlint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The linter should run from the directory of the file in the buffer):
|
||||
AssertLinterCwd '%s:h'
|
||||
AssertLinter 'gqlint', 'gqlint --reporter=simple %t'
|
43
sources_non_forked/ale/test/linter/test_haml_hamllint.vader
Normal file
43
sources_non_forked/ale/test/linter/test_haml_hamllint.vader
Normal file
@ -0,0 +1,43 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('haml', 'hamllint')
|
||||
|
||||
let g:default_command = 'haml-lint %t'
|
||||
|
||||
After:
|
||||
unlet! b:conf
|
||||
unlet! b:conf_hamllint
|
||||
unlet! b:conf_rubocop
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'haml-lint', 'haml-lint %t'
|
||||
|
||||
Execute(The command should have the .rubocop.yml prepended as an env var if one exists):
|
||||
call ale#test#SetFilename('../test-files/hamllint/rubocop-yml/subdir/file.haml')
|
||||
let b:conf = ale#path#Simplify(g:dir . '/../test-files/hamllint/rubocop-yml/.rubocop.yml')
|
||||
|
||||
AssertLinter 'haml-lint',
|
||||
\ ale#Env('HAML_LINT_RUBOCOP_CONF', b:conf) . 'haml-lint %t'
|
||||
|
||||
Execute(The command should have the nearest .haml-lint.yml set as --config if it exists):
|
||||
call ale#test#SetFilename('../test-files/hamllint/haml-lint-yml/subdir/file.haml')
|
||||
let b:conf = ale#path#Simplify(g:dir . '/../test-files/hamllint/haml-lint-yml/.haml-lint.yml')
|
||||
|
||||
AssertLinter 'haml-lint',
|
||||
\ 'haml-lint --config ' . ale#Escape(b:conf) . ' %t',
|
||||
|
||||
Execute(The command should include a .rubocop.yml and a .haml-lint if both are found):
|
||||
call ale#test#SetFilename('../test-files/hamllint/haml-lint-and-rubocop/subdir/file.haml')
|
||||
let b:conf_hamllint = ale#path#Simplify(g:dir . '/../test-files/hamllint/haml-lint-and-rubocop/.haml-lint.yml')
|
||||
let b:conf_rubocop = ale#path#Simplify(g:dir . '/../test-files/hamllint/haml-lint-and-rubocop/.rubocop.yml')
|
||||
|
||||
AssertLinter 'haml-lint',
|
||||
\ ale#Env('HAML_LINT_RUBOCOP_CONF', b:conf_rubocop)
|
||||
\ . 'haml-lint --config ' . ale#Escape(b:conf_hamllint) . ' %t'
|
||||
|
||||
Execute(The executable can be overridden):
|
||||
let b:ale_haml_hamllint_executable = 'bin/haml-lint'
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
AssertLinter 'bin/haml-lint', 'bin/haml-lint %t'
|
@ -0,0 +1,13 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('haskell', 'cabal_ghc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The options should be used in the command):
|
||||
AssertLinterCwd '%s:h'
|
||||
AssertLinter 'cabal', 'cabal exec -- ghc -fno-code -v0 %t'
|
||||
|
||||
let b:ale_haskell_cabal_ghc_options = 'foobar'
|
||||
|
||||
AssertLinter 'cabal', 'cabal exec -- ghc foobar %t'
|
12
sources_non_forked/ale/test/linter/test_haskell_ghc.vader
Normal file
12
sources_non_forked/ale/test/linter/test_haskell_ghc.vader
Normal file
@ -0,0 +1,12 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('haskell', 'ghc')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The options should be used in the command):
|
||||
AssertLinter 'ghc', 'ghc -fno-code -v0 %t'
|
||||
|
||||
let b:ale_haskell_ghc_options = 'foobar'
|
||||
|
||||
AssertLinter 'ghc', 'ghc foobar %t'
|
@ -0,0 +1,10 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('haskell', 'ghc_mod')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Default should use ghc-mod):
|
||||
AssertLinter
|
||||
\ 'ghc-mod',
|
||||
\ ale#Escape('ghc-mod') . ' --map-file %s=%t check %s'
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user