mirror of https://github.com/dense-analysis/ale
Massively reduce the amount of code needed for linter tests
This commit is contained in:
parent
5155a35a80
commit
a42999a639
|
@ -15,9 +15,9 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
|||
" note the --source 'BEGIN ...' is to prevent
|
||||
" gawk from attempting to execute the body of the script
|
||||
" it is linting.
|
||||
return ale_linters#awk#gawk#GetExecutable(a:buffer)
|
||||
return ale#Escape(ale_linters#awk#gawk#GetExecutable(a:buffer))
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' ' . ale#Var(a:buffer, 'awk_gawk_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||
\ . ' ' . '-f %t --lint /dev/null'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
||||
|
||||
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
||||
return 'mcs -unsafe --parse ' . ale#Var(a:buffer, 'cs_mcs_options') . ' %t'
|
||||
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
||||
|
||||
return 'mcs -unsafe --parse'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||
|
|
|
@ -29,16 +29,16 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
let l:out = ale#util#Tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:out)
|
||||
" register temporary module target file with ALE.
|
||||
let l:out = ale#engine#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'mcs -unsafe'
|
||||
\ . ' ' . ale#Var(a:buffer, 'cs_mcsc_options')
|
||||
\ . ' ' . l:lib_option
|
||||
\ . ' ' . l:r_option
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
\ . ' -out:' . l:out
|
||||
\ . ' -t:module'
|
||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
" Author: RyanSquared <vandor2012@gmail.com>
|
||||
" Description: `fusion-lint` linter for FusionScript files
|
||||
|
||||
let g:ale_fuse_fusionlint_executable =
|
||||
\ get(g:, 'ale_fuse_fusionlint_executable', 'fusion-lint')
|
||||
|
||||
let g:ale_fuse_fusionlint_options =
|
||||
\ get(g:, 'ale_fuse_fusionlint_options', '')
|
||||
call ale#Set('fuse_fusionlint_executable', 'fusion-lint')
|
||||
call ale#Set('fuse_fusionlint_options', '')
|
||||
|
||||
function! ale_linters#fuse#fusionlint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'fuse_fusionlint_executable')
|
||||
|
@ -13,7 +10,7 @@ endfunction
|
|||
|
||||
function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#fuse#fusionlint#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'fuse_fusionlint_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options'))
|
||||
\ . ' --filename %s -i'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -14,9 +14,9 @@ function! ale_linters#glsl#glslang#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#GetCommand(buffer) abort
|
||||
return ale_linters#glsl#glslang#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'glsl_glslang_options')
|
||||
\ . ' ' . '-C %t'
|
||||
return ale#Escape(ale_linters#glsl#glslang#GetExecutable(a:buffer))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'glsl_glslang_options'))
|
||||
\ . ' -C %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
|
||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
|
||||
return
|
||||
return ''
|
||||
endif
|
||||
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' gotype .'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -84,10 +84,10 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
|||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . ' -Xlint'
|
||||
\ . ' ' . l:cp_option
|
||||
\ . ' ' . l:sp_option
|
||||
\ . ale#Pad(l:cp_option)
|
||||
\ . ale#Pad(l:sp_option)
|
||||
\ . ' -d ' . ale#Escape(l:class_file_directory)
|
||||
\ . ' ' . ale#Var(a:buffer, 'java_javac_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'java_javac_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ endfunction
|
|||
|
||||
function! ale_linters#llvm#llc#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#llvm#llc#GetExecutable(a:buffer))
|
||||
\ . ' -filetype=null -o='
|
||||
\ . ale#Escape(g:ale#util#nul_file)
|
||||
\ . ' -filetype=null -o=' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort
|
||||
|
|
|
@ -42,9 +42,9 @@ endfunction
|
|||
|
||||
call ale#linter#Define('nasm', {
|
||||
\ 'name': 'nasm',
|
||||
\ 'executable': 'nasm',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'lint_file': 1,
|
||||
\ 'executable_callback': 'ale_linters#nasm#nasm#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#nasm#nasm#GetCommand',
|
||||
\ 'callback': 'ale_linters#nasm#nasm#Handle',
|
||||
\})
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: rails_best_practices, a code metric tool for rails projects
|
||||
|
||||
let g:ale_ruby_rails_best_practices_options =
|
||||
\ get(g:, 'ale_ruby_rails_best_practices_options', '')
|
||||
call ale#Set('ruby_rails_best_practices_options', '')
|
||||
call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices')
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
@ -22,8 +22,12 @@ function! ale_linters#ruby#rails_best_practices#Handle(buffer, lines) abort
|
|||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rails_best_practices#GetCommand(buffer) abort
|
||||
let l:executable = ale#handlers#rails_best_practices#GetExecutable(a:buffer)
|
||||
let l:executable = ale_linters#ruby#rails_best_practices#GetExecutable(a:buffer)
|
||||
let l:exec_args = l:executable =~? 'bundle$'
|
||||
\ ? ' exec rails_best_practices'
|
||||
\ : ''
|
||||
|
@ -46,7 +50,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'rails_best_practices',
|
||||
\ 'executable_callback': 'ale#handlers#rails_best_practices#GetExecutable',
|
||||
\ 'executable_callback': 'ale_linters#ruby#rails_best_practices#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#ruby#rails_best_practices#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rails_best_practices#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
" Author: Kevin Kays - https://github.com/okkays
|
||||
" Description: Support for the scalastyle checker.
|
||||
|
||||
let g:ale_scala_scalastyle_options =
|
||||
\ get(g:, 'ale_scala_scalastyle_options', '')
|
||||
|
||||
let g:ale_scalastyle_config_loc =
|
||||
call ale#Set('scala_scalastyle_options', '')
|
||||
" TODO: Remove support for the old option name in ALE 3.0.
|
||||
call ale#Set('scala_scalastyle_config',
|
||||
\ get(g:, 'ale_scalastyle_config_loc', '')
|
||||
\)
|
||||
|
||||
function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort
|
||||
" Look for help output from scalastyle first, which indicates that no
|
||||
|
@ -66,23 +66,13 @@ function! ale_linters#scala#scalastyle#GetCommand(buffer) abort
|
|||
|
||||
" If all else fails, try the global config.
|
||||
if empty(l:scalastyle_config)
|
||||
let l:scalastyle_config = get(g:, 'ale_scalastyle_config_loc', '')
|
||||
let l:scalastyle_config = ale#Var(a:buffer, 'scala_scalastyle_config')
|
||||
endif
|
||||
|
||||
" Build the command using the config file and additional options.
|
||||
let l:command = 'scalastyle'
|
||||
|
||||
if !empty(l:scalastyle_config)
|
||||
let l:command .= ' --config ' . ale#Escape(l:scalastyle_config)
|
||||
endif
|
||||
|
||||
if !empty(g:ale_scala_scalastyle_options)
|
||||
let l:command .= ' ' . g:ale_scala_scalastyle_options
|
||||
endif
|
||||
|
||||
let l:command .= ' %t'
|
||||
|
||||
return l:command
|
||||
return 'scalastyle'
|
||||
\ . (!empty(l:scalastyle_config) ? ' --config ' . ale#Escape(l:scalastyle_config) : '')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'scala_scalastyle_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scala', {
|
||||
|
|
|
@ -20,14 +20,12 @@ function! ale_linters#thrift#thrift#GetCommand(buffer) abort
|
|||
let l:generators = ['cpp']
|
||||
endif
|
||||
|
||||
let l:output_dir = ale#util#Tempname()
|
||||
call mkdir(l:output_dir)
|
||||
call ale#engine#ManageDirectory(a:buffer, l:output_dir)
|
||||
let l:output_dir = ale#engine#CreateDirectory(a:buffer)
|
||||
|
||||
return ale#Escape(ale_linters#thrift#thrift#GetExecutable(a:buffer))
|
||||
\ . ' ' . join(map(copy(l:generators), "'--gen ' . v:val"))
|
||||
\ . ' ' . join(map(copy(l:includes), "'-I ' . v:val"))
|
||||
\ . ' ' . ale#Var(a:buffer, 'thrift_thrift_options')
|
||||
\ . ale#Pad(join(map(copy(l:generators), "'--gen ' . v:val")))
|
||||
\ . ale#Pad(join(map(copy(l:includes), "'-I ' . v:val")))
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'thrift_thrift_options'))
|
||||
\ . ' -out ' . ale#Escape(l:output_dir)
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
|
|
@ -1,17 +1,7 @@
|
|||
" Author: Prashanth Chandra <https://github.com/prashcr>, Jonathan Clem <https://jclem.net>
|
||||
" Description: tslint for TypeScript files
|
||||
|
||||
call ale#Set('typescript_tslint_executable', 'tslint')
|
||||
call ale#Set('typescript_tslint_config_path', '')
|
||||
call ale#Set('typescript_tslint_rules_dir', '')
|
||||
call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('typescript_tslint_ignore_empty_files', 0)
|
||||
|
||||
function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [
|
||||
\ 'node_modules/.bin/tslint',
|
||||
\])
|
||||
endfunction
|
||||
call ale#handlers#tslint#InitVariables()
|
||||
|
||||
function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
|
||||
" Do not output any errors for empty files if the option is on.
|
||||
|
@ -70,7 +60,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer))
|
||||
\ . ale#Escape(ale#handlers#tslint#GetExecutable(a:buffer))
|
||||
\ . ' --format json'
|
||||
\ . l:tslint_config_option
|
||||
\ . l:tslint_rules_option
|
||||
|
@ -79,7 +69,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('typescript', {
|
||||
\ 'name': 'tslint',
|
||||
\ 'executable_callback': 'ale_linters#typescript#tslint#GetExecutable',
|
||||
\ 'executable_callback': 'ale#handlers#tslint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#typescript#tslint#GetCommand',
|
||||
\ 'callback': 'ale_linters#typescript#tslint#Handle',
|
||||
\})
|
||||
|
|
|
@ -11,7 +11,7 @@ endfunction
|
|||
|
||||
function! ale_linters#xml#xmllint#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#xml#xmllint#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'xml_xmllint_options')
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'xml_xmllint_options'))
|
||||
\ . ' --noout -'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -213,6 +213,25 @@ function! ale#Set(variable_name, default) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
" Given a string for adding to a command, return the string padded with a
|
||||
" space on the left if it is not empty. Otherwise return an empty string.
|
||||
"
|
||||
" This can be used for making command strings cleaner and easier to test.
|
||||
function! ale#Pad(string) abort
|
||||
return !empty(a:string) ? ' ' . a:string : ''
|
||||
endfunction
|
||||
|
||||
" Given a environment variable name and a value, produce part of a command for
|
||||
" setting an environment variable before running a command. The syntax will be
|
||||
" valid for cmd on Windows, or most shells on Unix.
|
||||
function! ale#Env(variable_name, value) abort
|
||||
if has('win32')
|
||||
return 'set ' . a:variable_name . '=' . ale#Escape(a:value) . ' && '
|
||||
endif
|
||||
|
||||
return a:variable_name . '=' . ale#Escape(a:value) . ' '
|
||||
endfunction
|
||||
|
||||
" Escape a string suitably for each platform.
|
||||
" shellescape does not work on Windows.
|
||||
function! ale#Escape(str) abort
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
let s:chain_results = []
|
||||
|
||||
function! ale#assert#WithChainResults(...) abort
|
||||
let s:chain_results = a:000
|
||||
endfunction
|
||||
|
||||
function! s:GetLinter() abort
|
||||
let l:linters = ale#linter#GetLintersLoaded()
|
||||
let l:filetype_linters = get(values(l:linters), 0, [])
|
||||
|
@ -21,15 +27,31 @@ function! ale#assert#Linter(expected_executable, expected_command) abort
|
|||
let l:executable = ale#linter#GetExecutable(l:buffer, l:linter)
|
||||
|
||||
if has_key(l:linter, 'command_chain')
|
||||
let l:command = []
|
||||
let l:callbacks = map(copy(l:linter.command_chain), 'v:val.callback')
|
||||
|
||||
for l:chain_item in l:linter.command_chain
|
||||
if empty(l:command)
|
||||
call add(l:command, call(l:chain_item.callback, [l:buffer]))
|
||||
" If the expected command is a string, just check the last one.
|
||||
if type(a:expected_command) is type('')
|
||||
if len(l:callbacks) is 1
|
||||
let l:command = call(l:callbacks[0], [l:buffer])
|
||||
else
|
||||
call add(l:command, call(l:chain_item.callback, [l:buffer, []]))
|
||||
let l:input = get(s:chain_results, len(l:callbacks) - 2, [])
|
||||
let l:command = call(l:callbacks[-1], [l:buffer, l:input])
|
||||
endif
|
||||
endfor
|
||||
else
|
||||
let l:command = []
|
||||
let l:chain_index = 0
|
||||
|
||||
for l:Callback in l:callbacks
|
||||
if l:chain_index is 0
|
||||
call add(l:command, call(l:Callback, [l:buffer]))
|
||||
else
|
||||
let l:input = get(s:chain_results, l:chain_index - 1, [])
|
||||
call add(l:command, call(l:Callback, [l:buffer, l:input]))
|
||||
endif
|
||||
|
||||
let l:chain_index += 1
|
||||
endfor
|
||||
endif
|
||||
else
|
||||
let l:command = ale#linter#GetCommand(l:buffer, l:linter)
|
||||
" Replace %e with the escaped executable, so tests keep passing after
|
||||
|
@ -42,9 +64,96 @@ function! ale#assert#Linter(expected_executable, expected_command) abort
|
|||
\ [l:executable, l:command]
|
||||
endfunction
|
||||
|
||||
command! -nargs=+ AssertLinter :call ale#assert#Linter(<args>)
|
||||
function! ale#assert#LinterNotExecuted() abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:executable = ale#linter#GetExecutable(l:buffer, l:linter)
|
||||
|
||||
Assert empty(l:executable), "The linter will be executed when it shouldn't be"
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LSPOptions(expected_options) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:initialization_options = ale#lsp_linter#GetOptions(l:buffer, l:linter)
|
||||
|
||||
AssertEqual a:expected_options, l:initialization_options
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LSPLanguage(expected_language) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:language = ale#util#GetFunction(l:linter.language_callback)(l:buffer)
|
||||
|
||||
AssertEqual a:expected_language, l:language
|
||||
endfunction
|
||||
|
||||
function! ale#assert#LSPProject(expected_root) abort
|
||||
let l:buffer = bufnr('')
|
||||
let l:linter = s:GetLinter()
|
||||
let l:root = ale#util#GetFunction(l:linter.project_root_callback)(l:buffer)
|
||||
|
||||
AssertEqual a:expected_root, l:root
|
||||
endfunction
|
||||
|
||||
" A dummy function for making sure this module is loaded.
|
||||
function! ale#assert#Init() abort
|
||||
function! ale#assert#SetUpLinterTest(filetype, name) abort
|
||||
" Set up a marker so ALE doesn't create real random temporary filenames.
|
||||
let g:ale_create_dummy_temporary_file = 1
|
||||
|
||||
" Remove current linters.
|
||||
call ale#linter#Reset()
|
||||
call ale#linter#PreventLoading(a:filetype)
|
||||
|
||||
let l:prefix = 'ale_' . a:filetype . '_' . a:name
|
||||
let b:filter_expr = 'v:val[: len(l:prefix) - 1] is# l:prefix'
|
||||
|
||||
Save g:ale_c_build_dir
|
||||
unlet! g:ale_c_build_dir
|
||||
|
||||
" Save and clear linter variables.
|
||||
" We'll load the runtime file to reset them to defaults.
|
||||
for l:key in filter(keys(g:), b:filter_expr)
|
||||
execute 'Save g:' . l:key
|
||||
unlet g:[l:key]
|
||||
endfor
|
||||
|
||||
unlet! b:ale_c_build_dir
|
||||
|
||||
for l:key in filter(keys(b:), b:filter_expr)
|
||||
unlet b:[l:key]
|
||||
endfor
|
||||
|
||||
execute 'runtime ale_linters/' . a:filetype . '/' . a:name . '.vim'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
command! -nargs=+ WithChainResults :call ale#assert#WithChainResults(<args>)
|
||||
command! -nargs=+ AssertLinter :call ale#assert#Linter(<args>)
|
||||
command! -nargs=0 AssertLinterNotExecuted :call ale#assert#LinterNotExecuted()
|
||||
command! -nargs=+ AssertLSPOptions :call ale#assert#LSPOptions(<args>)
|
||||
command! -nargs=+ AssertLSPLanguage :call ale#assert#LSPLanguage(<args>)
|
||||
command! -nargs=+ AssertLSPProject :call ale#assert#LSPProject(<args>)
|
||||
endfunction
|
||||
|
||||
function! ale#assert#TearDownLinterTest() abort
|
||||
unlet! g:ale_create_dummy_temporary_file
|
||||
let s:chain_results = []
|
||||
|
||||
delcommand WithChainResults
|
||||
delcommand AssertLinter
|
||||
delcommand AssertLinterNotExecuted
|
||||
delcommand AssertLSPOptions
|
||||
delcommand AssertLSPLanguage
|
||||
delcommand AssertLSPProject
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
|
||||
if exists('*ale#semver#ResetVersionCache')
|
||||
call ale#semver#ResetVersionCache()
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
@ -96,8 +96,25 @@ function! ale#engine#ManageDirectory(buffer, directory) abort
|
|||
call add(g:ale_buffer_info[a:buffer].temporary_directory_list, a:directory)
|
||||
endfunction
|
||||
|
||||
function! ale#engine#CreateFile(buffer) abort
|
||||
" This variable can be set to 1 in tests to stub this out.
|
||||
if get(g:, 'ale_create_dummy_temporary_file')
|
||||
return 'TEMP'
|
||||
endif
|
||||
|
||||
let l:temporary_file = ale#util#Tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:temporary_file)
|
||||
|
||||
return l:temporary_file
|
||||
endfunction
|
||||
|
||||
" Create a new temporary directory and manage it in one go.
|
||||
function! ale#engine#CreateDirectory(buffer) abort
|
||||
" This variable can be set to 1 in tests to stub this out.
|
||||
if get(g:, 'ale_create_dummy_temporary_file')
|
||||
return 'TEMP_DIR'
|
||||
endif
|
||||
|
||||
let l:temporary_directory = ale#util#Tempname()
|
||||
" Create the temporary directory for the file, unreadable by 'other'
|
||||
" users.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
" Description: Fixing files with tslint.
|
||||
|
||||
function! ale#fixers#tslint#Fix(buffer) abort
|
||||
let l:executable = ale_linters#typescript#tslint#GetExecutable(a:buffer)
|
||||
let l:executable = ale#handlers#tslint#GetExecutable(a:buffer)
|
||||
|
||||
let l:tslint_config_path = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
call ale#Set('ruby_rails_best_practices_options', '')
|
||||
call ale#Set('ruby_rails_best_practices_executable', 'rails_best_practices')
|
||||
|
||||
function! ale#handlers#rails_best_practices#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ruby_rails_best_practices_executable')
|
||||
endfunction
|
|
@ -0,0 +1,13 @@
|
|||
function! ale#handlers#tslint#InitVariables() abort
|
||||
call ale#Set('typescript_tslint_executable', 'tslint')
|
||||
call ale#Set('typescript_tslint_config_path', '')
|
||||
call ale#Set('typescript_tslint_rules_dir', '')
|
||||
call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('typescript_tslint_ignore_empty_files', 0)
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#tslint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'typescript_tslint', [
|
||||
\ 'node_modules/.bin/tslint',
|
||||
\])
|
||||
endfunction
|
|
@ -114,6 +114,18 @@ function! ale#lsp_linter#HandleLSPResponse(conn_id, response) abort
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! ale#lsp_linter#GetOptions(buffer, linter) abort
|
||||
let l:initialization_options = {}
|
||||
|
||||
if has_key(a:linter, 'initialization_options_callback')
|
||||
let l:initialization_options = ale#util#GetFunction(a:linter.initialization_options_callback)(a:buffer)
|
||||
elseif has_key(a:linter, 'initialization_options')
|
||||
let l:initialization_options = a:linter.initialization_options
|
||||
endif
|
||||
|
||||
return l:initialization_options
|
||||
endfunction
|
||||
|
||||
" Given a buffer, an LSP linter, and a callback to register for handling
|
||||
" messages, start up an LSP linter and get ready to receive errors or
|
||||
" completions.
|
||||
|
@ -128,13 +140,7 @@ function! ale#lsp_linter#StartLSP(buffer, linter, callback) abort
|
|||
return {}
|
||||
endif
|
||||
|
||||
let l:initialization_options = {}
|
||||
|
||||
if has_key(a:linter, 'initialization_options_callback')
|
||||
let l:initialization_options = ale#util#GetFunction(a:linter.initialization_options_callback)(a:buffer)
|
||||
elseif has_key(a:linter, 'initialization_options')
|
||||
let l:initialization_options = a:linter.initialization_options
|
||||
endif
|
||||
let l:initialization_options = ale#lsp_linter#GetOptions(a:buffer, a:linter)
|
||||
|
||||
if a:linter.lsp is# 'socket'
|
||||
let l:address = ale#linter#GetAddress(a:buffer, a:linter)
|
||||
|
|
|
@ -10,6 +10,7 @@ CONTENTS *ale-development-contents*
|
|||
2. Design Goals.........................|ale-design-goals|
|
||||
3. Coding Standards.....................|ale-coding-standards|
|
||||
4. Testing ALE..........................|ale-development-tests|
|
||||
4.1. Writing Linter Tests.............|ale-development-linter-tests|
|
||||
|
||||
===============================================================================
|
||||
1. Introduction *ale-development-introduction*
|
||||
|
@ -173,6 +174,9 @@ Look at existing tests in the codebase for examples of how to write tests.
|
|||
Refer to the Vader documentation for general information on how to write Vader
|
||||
tests: https://github.com/junegunn/vader.vim
|
||||
|
||||
See |ale-development-linter-tests| for more information on how to write linter
|
||||
tests.
|
||||
|
||||
When you add new linters or fixers, make sure to add them into the table in
|
||||
the README, and also into the |ale-support| list in the main help file. If you
|
||||
forget to keep them both in sync, you should see an error like the following
|
||||
|
@ -222,5 +226,82 @@ margin. For example, if you add a heading for an `aardvark` tool to
|
|||
Make sure to make the table of contents match the headings, and to keep the
|
||||
doc tags on the right margin.
|
||||
|
||||
===============================================================================
|
||||
4.1 Writing Linter Tests *ale-development-linter-tests*
|
||||
|
||||
Tests for ALE linters take two forms.
|
||||
|
||||
1. Tests for handling the output of commands.
|
||||
2. Tests for checking which commands are run, or connections are made.
|
||||
|
||||
Tests of the first form should go in the `test/handler` directory, and should
|
||||
be written like so. >
|
||||
|
||||
Before:
|
||||
" Load the file which defines the linter.
|
||||
runtime ale_linters/filetype/linter_name_here.vim
|
||||
|
||||
After:
|
||||
" Unload all linters again.
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The output should be correct):
|
||||
|
||||
" Test that the right loclist items are parsed from the handler.
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': 'Something went wrong',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#filetype#linter_name#Handle(bufnr(''), [
|
||||
\ '1:Something went wrong',
|
||||
\ ]
|
||||
<
|
||||
Tests for what ALE runs should go in the `test/command_callback` directory,
|
||||
and should be written like so. >
|
||||
|
||||
Before:
|
||||
" Load the linter and set up a series of commands, reset linter variables,
|
||||
" clear caches, etc.
|
||||
"
|
||||
" Vader's 'Save' command will be called here for linter variables.
|
||||
call ale#assert#SetUpLinterTest('filetype', 'linter_name')
|
||||
|
||||
After:
|
||||
" Reset linters, variables, etc.
|
||||
"
|
||||
" Vader's 'Restore' command will be called here.
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
" AssertLinter checks the executable and command.
|
||||
" Pass expected_executable, expected_command
|
||||
AssertLinter 'some-command', ale#Escape('some-command') . ' --foo'
|
||||
|
||||
Execute(Check chained commands):
|
||||
" WithChainResults can be called with 1 or more list for passing output
|
||||
" to chained commands. The output for each callback defaults to an empty
|
||||
" list.
|
||||
WithChainResults ['v2.1.2']
|
||||
" Given a List of commands, check all of them.
|
||||
" Given a String, only the last command in the chain will be checked.
|
||||
AssertLinter 'some-command', [
|
||||
\ ale#Escape('some-command') . ' --version',
|
||||
\ ale#Escape('some-command') . ' --foo',
|
||||
\]
|
||||
<
|
||||
The full list of commands that will be temporarily defined for linter tests
|
||||
given the above setup are as follows.
|
||||
|
||||
`WithChainResults [...]` - Define output for command chain functions.
|
||||
`AssertLinter executable, command` - Check the executable and command.
|
||||
`AssertLinterNotExecuted` - Check that linters will not be executed.
|
||||
`AssertLSPLanguage language` - Check the language given to an LSP server.
|
||||
`AssertLSPOptions options_dict` - Check the options given to an LSP server.
|
||||
`AssertLSPProject project_root` - Check the root given to an LSP server.
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
|
|
@ -41,8 +41,8 @@ To disable `scalastyle` globally, use |g:ale_linters| like so: >
|
|||
See |g:ale_linters| for more information on disabling linters.
|
||||
|
||||
|
||||
g:ale_scalastyle_config_loc *g:ale_scalastyle_config_loc*
|
||||
|
||||
g:ale_scala_scalastyle_config *g:ale_scala_scalastyle_config*
|
||||
*b:ale_scala_scalastyle_config*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
|
@ -54,7 +54,7 @@ g:ale_scalastyle_config_loc *g:ale_scalastyle_config_loc*
|
|||
|
||||
|
||||
g:ale_scala_scalastyle_options *g:ale_scala_scalastyle_options*
|
||||
|
||||
*b:ale_scala_scalastyle_options*
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
|
|
36
doc/ale.txt
36
doc/ale.txt
|
@ -2074,6 +2074,29 @@ ALEStopAllLSPs *ALEStopAllLSPs*
|
|||
===============================================================================
|
||||
9. API *ale-api*
|
||||
|
||||
ALE offers a number of functions for running linters or fixers, or defining
|
||||
them. The following functions are part of the publicly documented part of that
|
||||
API, and should be expected to continue to work.
|
||||
|
||||
|
||||
ale#Env(variable_name, value) *ale#Env()*
|
||||
|
||||
Given a variable name and a string value, produce a string for including in
|
||||
a command for setting environment variables. This function can be used for
|
||||
building a command like so. >
|
||||
|
||||
:echo string(ale#Env('VAR', 'some value') . 'command')
|
||||
'VAR=''some value'' command' # On Linux or Mac OSX
|
||||
'set VAR="some value" && command' # On Windows
|
||||
|
||||
|
||||
ale#Pad(string) *ale#Pad()*
|
||||
|
||||
Given a string or any |empty()| value, return either the string prefixed
|
||||
with a single space, or an empty string. This function can be used to build
|
||||
parts of a command from variables.
|
||||
|
||||
|
||||
ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()*
|
||||
|
||||
Run linters for the current buffer, based on the filetype of the buffer,
|
||||
|
@ -2098,8 +2121,17 @@ ale#Queue(delay, [linting_flag, buffer_number]) *ale#Queue()*
|
|||
ale#engine#CreateDirectory(buffer) *ale#engine#CreateDirectory()*
|
||||
|
||||
Create a new temporary directory with a unique name, and manage that
|
||||
directory with |ale#engine#ManageDirectory()|, so it will be removed as
|
||||
soon as possible.
|
||||
directory with |ale#engine#ManageDirectory()|, so it will be removed as soon
|
||||
as possible.
|
||||
|
||||
It is advised to only call this function from a callback function for
|
||||
returning a linter command to run.
|
||||
|
||||
|
||||
ale#engine#CreateFile(buffer) *ale#engine#CreateFile()*
|
||||
|
||||
Create a new temporary file with a unique name, and manage that file with
|
||||
|ale#engine#ManageFile()|, so it will be removed as soon as possible.
|
||||
|
||||
It is advised to only call this function from a callback function for
|
||||
returning a linter command to run.
|
||||
|
|
|
@ -149,13 +149,18 @@ failed=0
|
|||
index=0
|
||||
|
||||
for pid in $pid_list; do
|
||||
this_failed=0
|
||||
index=$((index+1))
|
||||
|
||||
if ! wait "$pid"; then
|
||||
failed=1
|
||||
this_failed=1
|
||||
fi
|
||||
|
||||
cat "$output_dir/$index"
|
||||
# Hide output for things that passed if -q is set.
|
||||
if [ "$quiet_flag" != '-q' ] || ((this_failed)); then
|
||||
cat "$output_dir/$index"
|
||||
fi
|
||||
done
|
||||
|
||||
if ((failed)); then
|
||||
|
|
|
@ -1,39 +1,18 @@
|
|||
Before:
|
||||
Save g:ale_asm_gcc_executable
|
||||
Save g:ale_asm_gcc_options
|
||||
|
||||
unlet! g:ale_asm_gcc_executable
|
||||
unlet! b:ale_asm_gcc_executable
|
||||
unlet! g:ale_asm_gcc_options
|
||||
unlet! b:ale_asm_gcc_options
|
||||
|
||||
runtime ale_linters/asm/gcc.vim
|
||||
|
||||
call ale#assert#SetUpLinterTest('asm', 'gcc')
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
let b:command_tail = ' -x assembler -fsyntax-only -iquote'
|
||||
\ . ' ' . ale#Escape(getcwd())
|
||||
\ . ' ' . ale#Escape(g:dir)
|
||||
\ . ' -Wall -'
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_asm_gcc_executable
|
||||
unlet! b:ale_asm_gcc_options
|
||||
call ale#linter#Reset()
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'gcc', ale_linters#asm#gcc#GetExecutable(bufnr(''))
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
|
||||
|
||||
let b:ale_asm_gcc_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#asm#gcc#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('gcc') . b:command_tail,
|
||||
\ ale_linters#asm#gcc#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_asm_gcc_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#asm#gcc#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
|
|
@ -1,39 +1,24 @@
|
|||
Before:
|
||||
Save g:ale_ruby_brakeman_options
|
||||
|
||||
runtime ale_linters/ruby/brakeman.vim
|
||||
|
||||
let g:ale_ruby_brakeman_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('ruby', 'brakeman')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The brakeman command callback should detect absence of a valid Rails app):
|
||||
call ale#test#SetFilename('../ruby_fixtures/not_a_rails_app/test.rb')
|
||||
|
||||
AssertEqual
|
||||
\ '',
|
||||
\ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
|
||||
AssertLinter 'brakeman', ''
|
||||
|
||||
Execute(The brakeman command callback should find a valid Rails app root):
|
||||
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb')
|
||||
|
||||
AssertEqual
|
||||
\ 'brakeman -f json -q -p '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
|
||||
\ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
|
||||
AssertLinter 'brakeman', 'brakeman -f json -q -p '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app'))
|
||||
|
||||
Execute(The brakeman command callback should include configured options):
|
||||
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/db/test.rb')
|
||||
|
||||
let g:ale_ruby_brakeman_options = '--combobulate'
|
||||
|
||||
AssertEqual
|
||||
\ 'brakeman -f json -q --combobulate -p '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app')),
|
||||
\ ale_linters#ruby#brakeman#GetCommand(bufnr(''))
|
||||
AssertLinter 'brakeman', 'brakeman -f json -q --combobulate -p '
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../ruby_fixtures/valid_rails_app'))
|
||||
|
|
|
@ -1,39 +1,17 @@
|
|||
Before:
|
||||
Save g:ale_c_clang_executable
|
||||
Save g:ale_c_clang_options
|
||||
|
||||
unlet! g:ale_c_clang_executable
|
||||
unlet! b:ale_c_clang_executable
|
||||
unlet! g:ale_c_clang_options
|
||||
unlet! b:ale_c_clang_options
|
||||
|
||||
runtime ale_linters/c/clang.vim
|
||||
|
||||
call ale#assert#SetUpLinterTest('c', 'clang')
|
||||
let b:command_tail = ' -S -x c -fsyntax-only -iquote'
|
||||
\ . ' ' . ale#Escape(getcwd())
|
||||
\ . ' -std=c11 -Wall -'
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_c_clang_executable
|
||||
unlet! b:ale_c_clang_options
|
||||
call ale#linter#Reset()
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'clang', ale_linters#c#clang#GetExecutable(bufnr(''))
|
||||
AssertLinter 'clang', ['', ale#Escape('clang') . b:command_tail]
|
||||
|
||||
let b:ale_c_clang_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#c#clang#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('clang') . b:command_tail,
|
||||
\ ale_linters#c#clang#GetCommand(bufnr(''), [])
|
||||
|
||||
let b:ale_c_clang_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#c#clang#GetCommand(bufnr(''), [])
|
||||
AssertLinter 'foobar', ['', ale#Escape('foobar') . b:command_tail]
|
||||
|
|
|
@ -1,77 +1,49 @@
|
|||
Before:
|
||||
Save g:ale_c_clangtidy_checks
|
||||
Save g:ale_c_clangtidy_options
|
||||
Save g:ale_c_build_dir
|
||||
|
||||
unlet! g:ale_c_build_dir
|
||||
unlet! b:ale_c_build_dir
|
||||
unlet! g:ale_c_clangtidy_checks
|
||||
unlet! b:ale_c_clangtidy_checks
|
||||
unlet! g:ale_c_clangtidy_options
|
||||
unlet! b:ale_c_clangtidy_options
|
||||
|
||||
runtime ale_linters/c/clangtidy.vim
|
||||
|
||||
call ale#assert#SetUpLinterTest('c', 'clangtidy')
|
||||
call ale#test#SetFilename('test.c')
|
||||
|
||||
After:
|
||||
unlet! b:ale_c_build_dir
|
||||
unlet! b:ale_c_clangtidy_checks
|
||||
unlet! b:ale_c_clangtidy_options
|
||||
unlet! b:ale_c_clangtidy_executable
|
||||
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The clangtidy command default should be correct):
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s',
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
|
||||
Execute(You should be able to remove the -checks option for clang-tidy):
|
||||
let b:ale_c_clangtidy_checks = []
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' %s',
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
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-*']
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s',
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
|
||||
|
||||
Execute(You should be able to manually set compiler flags for clang-tidy):
|
||||
let b:ale_c_clangtidy_options = '-Wall'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -- -Wall',
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
\
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
|
||||
Execute(The build directory should be configurable):
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar'),
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory setting should override the options):
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_c_clangtidy_options = '-Wall'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -p ' . ale#Escape('/foo/bar'),
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
\ . ' -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory should be ignored for header files):
|
||||
call ale#test#SetFilename('test.h')
|
||||
|
@ -79,24 +51,17 @@ Execute(The build directory should be ignored for header files):
|
|||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_c_clangtidy_options = '-Wall'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -- -Wall',
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
\
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
|
||||
call ale#test#SetFilename('test.h')
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
\ . ' -- -Wall',
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_c_clangtidy_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s',
|
||||
\ ale_linters#c#clangtidy#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
|
|
|
@ -1,49 +1,24 @@
|
|||
Before:
|
||||
Save g:ale_c_cppcheck_executable
|
||||
Save g:ale_c_cppcheck_options
|
||||
|
||||
unlet! g:ale_c_cppcheck_executable
|
||||
unlet! b:ale_c_cppcheck_executable
|
||||
unlet! g:ale_c_cppcheck_options
|
||||
unlet! b:ale_c_cppcheck_options
|
||||
|
||||
runtime ale_linters/c/cppcheck.vim
|
||||
call ale#assert#SetUpLinterTest('c', 'cppcheck')
|
||||
|
||||
let b:command_tail = ' -q --language=c --enable=style %t'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_c_cppcheck_executable
|
||||
unlet! b:ale_c_cppcheck_options
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'cppcheck', ale_linters#c#cppcheck#GetExecutable(bufnr(''))
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail
|
||||
|
||||
let b:ale_c_cppcheck_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#c#cppcheck#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('cppcheck') . b:command_tail,
|
||||
\ ale_linters#c#cppcheck#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_c_cppcheck_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#c#cppcheck#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
||||
Execute(cppcheck for C++ should detect compile_commands.json files):
|
||||
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'cppcheck',
|
||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one')) . ' && '
|
||||
\ . ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c --project=compile_commands.json --enable=style %t',
|
||||
\ ale_linters#c#cppcheck#GetCommand(bufnr(''))
|
||||
\ . ' -q --language=c --project=compile_commands.json --enable=style %t'
|
||||
|
|
|
@ -1,51 +1,24 @@
|
|||
Before:
|
||||
Save g:ale_c_flawfinder_executable
|
||||
Save g:ale_c_flawfinder_options
|
||||
Save g:ale_c_flawfinder_minlevel
|
||||
|
||||
unlet! g:ale_c_flawfinder_executable
|
||||
unlet! b:ale_c_flawfinder_executable
|
||||
unlet! g:ale_c_flawfinder_options
|
||||
unlet! b:ale_c_flawfinder_options
|
||||
unlet! g:ale_c_flawfinder_minlevel
|
||||
unlet! b:ale_c_flawfinder_minlevel
|
||||
|
||||
runtime ale_linters/c/flawfinder.vim
|
||||
call ale#assert#SetUpLinterTest('c', 'flawfinder')
|
||||
|
||||
After:
|
||||
unlet! b:ale_c_flawfinder_executable
|
||||
unlet! b:ale_c_flawfinder_options
|
||||
unlet! b:ale_c_flawfinder_minlevel
|
||||
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The flawfinder command should be correct):
|
||||
AssertEqual
|
||||
\ ale#Escape('flawfinder')
|
||||
\ . ' -CDQS --minlevel=1 %t',
|
||||
\ ale_linters#c#flawfinder#GetCommand(bufnr(''))
|
||||
AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t'
|
||||
|
||||
Execute(The minlevel of flawfinder should be configurable):
|
||||
let b:ale_c_flawfinder_minlevel = 8
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('flawfinder')
|
||||
\ . ' -CDQS --minlevel=8 %t',
|
||||
\ ale_linters#c#flawfinder#GetCommand(bufnr(''))
|
||||
AssertLinter 'flawfinder', ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t'
|
||||
|
||||
Execute(Additional flawfinder options should be configurable):
|
||||
let b:ale_c_flawfinder_options = ' --foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('flawfinder')
|
||||
\ . ' -CDQS --foobar --minlevel=1 %t',
|
||||
\ ale_linters#c#flawfinder#GetCommand(bufnr(''))
|
||||
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'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foo/bar')
|
||||
\ . ' -CDQS --minlevel=1 %t',
|
||||
\ ale_linters#c#flawfinder#GetCommand(bufnr(''))
|
||||
AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t'
|
||||
|
|
|
@ -1,39 +1,18 @@
|
|||
Before:
|
||||
Save g:ale_c_gcc_executable
|
||||
Save g:ale_c_gcc_options
|
||||
|
||||
unlet! g:ale_c_gcc_executable
|
||||
unlet! b:ale_c_gcc_executable
|
||||
unlet! g:ale_c_gcc_options
|
||||
unlet! b:ale_c_gcc_options
|
||||
|
||||
runtime ale_linters/c/gcc.vim
|
||||
call ale#assert#SetUpLinterTest('c', 'gcc')
|
||||
|
||||
let b:command_tail = ' -S -x c -fsyntax-only -iquote'
|
||||
\ . ' ' . ale#Escape(getcwd())
|
||||
\ . ' -std=c11 -Wall -'
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_c_gcc_executable
|
||||
unlet! b:ale_c_gcc_options
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'gcc', ale_linters#c#gcc#GetExecutable(bufnr(''))
|
||||
AssertLinter 'gcc', ['', ale#Escape('gcc') . b:command_tail]
|
||||
|
||||
let b:ale_c_gcc_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#c#gcc#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('gcc') . b:command_tail,
|
||||
\ ale_linters#c#gcc#GetCommand(bufnr(''), [])
|
||||
|
||||
let b:ale_c_gcc_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#c#gcc#GetCommand(bufnr(''), [])
|
||||
AssertLinter 'foobar', ['', ale#Escape('foobar') . b:command_tail]
|
||||
|
|
|
@ -1,223 +1,130 @@
|
|||
Before:
|
||||
Save g:ale_rust_cargo_use_check
|
||||
Save g:ale_rust_cargo_check_all_targets
|
||||
Save g:ale_rust_cargo_check_tests
|
||||
Save g:ale_rust_cargo_check_examples
|
||||
Save g:ale_rust_cargo_default_feature_behavior
|
||||
Save g:ale_rust_cargo_include_features
|
||||
Save g:ale_rust_cargo_avoid_whole_workspace
|
||||
|
||||
unlet! g:ale_rust_cargo_use_check
|
||||
unlet! g:ale_rust_cargo_check_all_targets
|
||||
unlet! g:ale_rust_cargo_check_tests
|
||||
unlet! g:ale_rust_cargo_check_examples
|
||||
unlet! g:ale_rust_cargo_default_feature_behavior
|
||||
unlet! g:ale_rust_cargo_include_features
|
||||
unlet! g:ale_rust_cargo_avoid_whole_workspace
|
||||
|
||||
runtime ale_linters/rust/cargo.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('rust', 'cargo')
|
||||
|
||||
let g:suffix = ' --frozen --message-format=json -q'
|
||||
|
||||
" Test with version 0.22.0 by default.
|
||||
WithChainResults ['cargo 0.22.0 (3423351a5 2017-10-06)']
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
unlet! g:suffix
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#semver#ResetVersionCache()
|
||||
Execute(The linter should not be executed when there's no Cargo.toml file):
|
||||
AssertLinterNotExecuted
|
||||
|
||||
Execute(An empty string should be returned for the cargo executable when there's no Cargo.toml file):
|
||||
AssertEqual
|
||||
\ '',
|
||||
\ ale_linters#rust#cargo#GetCargoExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be returned when there is a Cargo.toml file):
|
||||
Execute(The linter should be executed when there is a Cargo.toml file):
|
||||
call ale#test#SetFilename('cargo_paths/test.rs')
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo',
|
||||
\ ale_linters#rust#cargo#GetCargoExecutable(bufnr(''))
|
||||
|
||||
Execute(The VersionCheck function should return the --version command):
|
||||
AssertEqual
|
||||
\ 'cargo --version',
|
||||
\ ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter 'cargo',
|
||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cargo_paths')) . ' && '
|
||||
\ . 'cargo build --frozen --message-format=json -q'
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual
|
||||
\ 'cargo build' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
WithChainResults []
|
||||
AssertLinter '', ['cargo --version', 'cargo build' . g:suffix]
|
||||
|
||||
Execute(`cargo check` should be used when the version is new enough):
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.17.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
WithChainResults ['cargo 0.17.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter '', ['cargo --version', 'cargo check' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter '', ['', 'cargo check' . g:suffix]
|
||||
|
||||
Execute(`cargo build` should be used when cargo is too old):
|
||||
AssertEqual
|
||||
\ 'cargo build' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.16.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
WithChainResults ['cargo 0.16.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter '', ['cargo --version', 'cargo build' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
AssertEqual
|
||||
\ 'cargo build' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter '', ['', '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
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo build' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.24.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
WithChainResults ['cargo 0.24.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter '', ['cargo --version', 'cargo build' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
AssertEqual
|
||||
\ 'cargo build' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter '', ['', 'cargo build' . g:suffix]
|
||||
|
||||
Execute(`cargo check` should be used when the version is new enough):
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
AssertLinter '', ['cargo --version', 'cargo check' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter '', ['', '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
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo check --all-targets' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
AssertLinter '', ['cargo --version', 'cargo check --all-targets' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
AssertEqual
|
||||
\ 'cargo check --all-targets' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter '', ['', '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
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo check --tests' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
AssertLinter '', ['cargo --version', 'cargo check --tests' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
AssertEqual
|
||||
\ 'cargo check --tests' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter '', ['', '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
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo check --examples' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
AssertLinter '', ['cargo --version', 'cargo check --examples' . g:suffix]
|
||||
|
||||
" We should cache the version check
|
||||
AssertEqual
|
||||
\ 'cargo check --examples' . g:suffix,
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual '', ale_linters#rust#cargo#VersionCheck(bufnr(''))
|
||||
WithChainResults []
|
||||
AssertLinter '', ['', 'cargo check --examples' . g:suffix]
|
||||
|
||||
Execute(--no-default-features should be used when g:ale_rust_cargo_default_feature_behavior is none):
|
||||
let g:ale_rust_cargo_default_feature_behavior = 'none'
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'none'
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix . ' --no-default-features',
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
AssertLinter '', ['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 g:ale_rust_cargo_default_feature_behavior = 'none'
|
||||
let g:ale_rust_cargo_include_features = 'foo bar'
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'none'
|
||||
let b:ale_rust_cargo_include_features = 'foo bar'
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix . ' --no-default-features --features ' .
|
||||
\ (fnamemodify(&shell, ':t') is? 'cmd.exe' ? '"foo bar"' : "'foo bar'"),
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
AssertLinter '', ['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 g:ale_rust_cargo_default_feature_behavior = 'default'
|
||||
let g:ale_rust_cargo_include_features = "foo bar baz"
|
||||
let b:ale_rust_cargo_default_feature_behavior = 'default'
|
||||
let b:ale_rust_cargo_include_features = "foo bar baz"
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix . ' --features ' .
|
||||
\ (fnamemodify(&shell, ':t') is? 'cmd.exe' ? '"foo bar baz"' : "'foo bar baz'"),
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
AssertLinter '', ['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 g:ale_rust_cargo_default_feature_behavior = '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 g:ale_rust_cargo_include_features = 'foo bar'
|
||||
let b:ale_rust_cargo_include_features = 'foo bar'
|
||||
|
||||
AssertEqual
|
||||
\ 'cargo check' . g:suffix . ' --all-features',
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [
|
||||
\ 'cargo 0.22.0 (3423351a5 2017-10-06)',
|
||||
\ ])
|
||||
WithChainResults ['cargo 0.22.0 (3423351a5 2017-10-06)']
|
||||
AssertLinter '', ['cargo --version', 'cargo check --frozen --message-format=json -q --all-features']
|
||||
|
||||
Execute(When a crate belongs to a workspace we chdir into the crate.):
|
||||
Execute(When a crate belongs to a workspace we should cd into the crate):
|
||||
call ale#test#SetFilename('cargo_workspace_paths/subpath/test.rs')
|
||||
|
||||
if ale#Has('win32')
|
||||
let test_cdprefix = "C:\\testplugin\\test\\command_callback\\cargo_workspace_paths\\subpath"
|
||||
else
|
||||
let test_cdprefix = "'/testplugin/test/command_callback/cargo_workspace_paths/subpath'"
|
||||
endif
|
||||
|
||||
AssertEqual
|
||||
\ "cd ".test_cdprefix." && cargo build --frozen --message-format=json -q",
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
AssertLinter 'cargo', [
|
||||
\ 'cargo --version',
|
||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cargo_workspace_paths/subpath')) . ' && '
|
||||
\ . 'cargo check --frozen --message-format=json -q',
|
||||
\]
|
||||
|
||||
Execute(When a crate belongs to a workspace we chdir into the crate, unless we disabled it):
|
||||
let g:ale_rust_cargo_avoid_whole_workspace = 0
|
||||
call ale#test#SetFilename('cargo_workspace_paths/subpath/test.rs')
|
||||
|
||||
AssertEqual
|
||||
\ "cargo build --frozen --message-format=json -q",
|
||||
\ ale_linters#rust#cargo#GetCommand(bufnr(''), [])
|
||||
AssertLinter 'cargo', [
|
||||
\ 'cargo --version',
|
||||
\ 'cargo check --frozen --message-format=json -q',
|
||||
\]
|
||||
|
|
|
@ -1,74 +1,46 @@
|
|||
Before:
|
||||
Save g:ale_cpp_clangtidy_checks
|
||||
Save g:ale_cpp_clangtidy_options
|
||||
Save g:ale_c_build_dir
|
||||
|
||||
unlet! g:ale_c_build_dir
|
||||
unlet! b:ale_c_build_dir
|
||||
unlet! g:ale_cpp_clangtidy_checks
|
||||
unlet! b:ale_cpp_clangtidy_checks
|
||||
unlet! g:ale_cpp_clangtidy_options
|
||||
unlet! b:ale_cpp_clangtidy_options
|
||||
|
||||
runtime ale_linters/cpp/clangtidy.vim
|
||||
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
|
||||
call ale#test#SetFilename('test.cpp')
|
||||
|
||||
After:
|
||||
unlet! b:ale_c_build_dir
|
||||
unlet! b:ale_cpp_clangtidy_checks
|
||||
unlet! b:ale_cpp_clangtidy_options
|
||||
unlet! b:ale_cpp_clangtidy_executable
|
||||
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The clangtidy command default should be correct):
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s',
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
|
||||
Execute(You should be able to remove the -checks option for clang-tidy):
|
||||
let b:ale_cpp_clangtidy_checks = []
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' %s',
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
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-*']
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s',
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
|
||||
|
||||
Execute(You should be able to manually set compiler flags for clang-tidy):
|
||||
let b:ale_cpp_clangtidy_options = '-Wall'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall',
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
\
|
||||
Execute(The build directory should be configurable):
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar'),
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory setting should override the options):
|
||||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_cpp_clangtidy_options = '-Wall'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar'),
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar')
|
||||
|
||||
Execute(The build directory should be ignored for header files):
|
||||
call ale#test#SetFilename('test.h')
|
||||
|
@ -76,22 +48,16 @@ Execute(The build directory should be ignored for header files):
|
|||
let b:ale_c_build_dir = '/foo/bar'
|
||||
let b:ale_cpp_clangtidy_options = '-Wall'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall',
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
\
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
|
||||
call ale#test#SetFilename('test.hpp')
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('clang-tidy')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall',
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
AssertLinter 'clang-tidy',
|
||||
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_cpp_clangtidy_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar')
|
||||
\ . ' -checks=' . ale#Escape('*') . ' %s',
|
||||
\ ale_linters#cpp#clangtidy#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s'
|
||||
|
|
|
@ -1,39 +1,16 @@
|
|||
Before:
|
||||
Save g:ale_cpp_clang_executable
|
||||
Save g:ale_cpp_clang_options
|
||||
|
||||
unlet! g:ale_cpp_clang_executable
|
||||
unlet! b:ale_cpp_clang_executable
|
||||
unlet! g:ale_cpp_clang_options
|
||||
unlet! b:ale_cpp_clang_options
|
||||
|
||||
runtime ale_linters/cpp/clang.vim
|
||||
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clang')
|
||||
let b:command_tail = ' -S -x c++ -fsyntax-only -iquote'
|
||||
\ . ' ' . ale#Escape(getcwd())
|
||||
\ . ' -std=c++14 -Wall -'
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_cpp_clang_executable
|
||||
unlet! b:ale_cpp_clang_options
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'clang++', ale_linters#cpp#clang#GetExecutable(bufnr(''))
|
||||
AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail
|
||||
|
||||
let b:ale_cpp_clang_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cpp#clang#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('clang++') . b:command_tail,
|
||||
\ ale_linters#cpp#clang#GetCommand(bufnr(''), [])
|
||||
|
||||
let b:ale_cpp_clang_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#cpp#clang#GetCommand(bufnr(''), [])
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
|
|
@ -1,63 +1,35 @@
|
|||
Before:
|
||||
Save g:ale_cpp_clangcheck_executable
|
||||
Save g:ale_cpp_clangcheck_options
|
||||
|
||||
unlet! g:ale_cpp_clangcheck_executable
|
||||
unlet! b:ale_cpp_clangcheck_executable
|
||||
unlet! g:ale_cpp_clangcheck_options
|
||||
unlet! b:ale_cpp_clangcheck_options
|
||||
|
||||
runtime ale_linters/cpp/clangcheck.vim
|
||||
call ale#assert#SetUpLinterTest('cpp', 'clangcheck')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_cpp_clangcheck_executable
|
||||
unlet! b:ale_cpp_clangcheck_options
|
||||
unlet! b:ale_c_build_dir
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'clang-check', ale_linters#cpp#clangcheck#GetExecutable(bufnr(''))
|
||||
|
||||
let b:ale_cpp_clangcheck_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cpp#clangcheck#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s'
|
||||
\ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text',
|
||||
\ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
|
||||
\ . ' -analyze %s -extra-arg -Xclang -extra-arg -analyzer-output=text'
|
||||
|
||||
let b:ale_cpp_clangcheck_executable = 'foobar'
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated.
|
||||
AssertEqual
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar')
|
||||
\ . ' -analyze %s'
|
||||
\ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text',
|
||||
\ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
|
||||
\ . ' -analyze %s -extra-arg -Xclang -extra-arg -analyzer-output=text'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_cpp_clangcheck_options = '--something'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s'
|
||||
\ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text'
|
||||
\ . ' --something',
|
||||
\ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
|
||||
\ . ' --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'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'clang-check',
|
||||
\ ale#Escape('clang-check')
|
||||
\ . ' -analyze %s '
|
||||
\ . '--something -p '
|
||||
\ . ale#Escape('/foo/bar'),
|
||||
\ ale_linters#cpp#clangcheck#GetCommand(bufnr(''))
|
||||
\ . ' -analyze %s --something -p ' . ale#Escape('/foo/bar')
|
||||
|
|
|
@ -1,49 +1,22 @@
|
|||
Before:
|
||||
Save g:ale_cpp_cppcheck_executable
|
||||
Save g:ale_cpp_cppcheck_options
|
||||
|
||||
unlet! g:ale_cpp_cppcheck_executable
|
||||
unlet! b:ale_cpp_cppcheck_executable
|
||||
unlet! g:ale_cpp_cppcheck_options
|
||||
unlet! b:ale_cpp_cppcheck_options
|
||||
|
||||
runtime ale_linters/cpp/cppcheck.vim
|
||||
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cppcheck')
|
||||
let b:command_tail = ' -q --language=c++ --enable=style %t'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_cpp_cppcheck_executable
|
||||
unlet! b:ale_cpp_cppcheck_options
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'cppcheck', ale_linters#cpp#cppcheck#GetExecutable(bufnr(''))
|
||||
AssertLinter 'cppcheck', ale#Escape('cppcheck') . b:command_tail
|
||||
|
||||
let b:ale_cpp_cppcheck_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cpp#cppcheck#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('cppcheck') . b:command_tail,
|
||||
\ ale_linters#cpp#cppcheck#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_cpp_cppcheck_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#cpp#cppcheck#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
||||
Execute(cppcheck for C++ should detect compile_commands.json files):
|
||||
call ale#test#SetFilename('cppcheck_paths/one/foo.cpp')
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'cppcheck',
|
||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/cppcheck_paths/one')) . ' && '
|
||||
\ . ale#Escape('cppcheck')
|
||||
\ . ' -q --language=c++ --project=compile_commands.json --enable=style %t',
|
||||
\ ale_linters#cpp#cppcheck#GetCommand(bufnr(''))
|
||||
\ . ' -q --language=c++ --project=compile_commands.json --enable=style %t'
|
||||
|
|
|
@ -2,47 +2,21 @@
|
|||
" Description: A language server for C++
|
||||
|
||||
Before:
|
||||
Save g:ale_cpp_cquery_executable
|
||||
Save g:ale_cpp_cquery_cache_directory
|
||||
|
||||
unlet! g:ale_cpp_cquery_executable
|
||||
unlet! b:ale_cpp_cquery_executable
|
||||
unlet! g:ale_cpp_cquery_cache_directory
|
||||
unlet! b:ale_cpp_cquery_cache_directory
|
||||
|
||||
runtime ale_linters/cpp/cquery.vim
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cquery')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:ale_cpp_cquery_executable
|
||||
unlet! b:ale_cpp_cquery_cache_directory
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'cquery', ale_linters#cpp#cquery#GetExecutable(bufnr(''))
|
||||
AssertLinter 'cquery', ale#Escape('cquery')
|
||||
|
||||
let b:ale_cpp_cquery_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cpp#cquery#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('cquery'),
|
||||
\ ale_linters#cpp#cquery#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_cpp_cquery_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar'),
|
||||
\ ale_linters#cpp#cquery#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
|
||||
Execute(The cache directory should be configurable):
|
||||
AssertEqual
|
||||
\ {'cacheDirectory': expand('$HOME/.cache/cquery')},
|
||||
\ ale_linters#cpp#cquery#GetInitializationOptions(bufnr(''))
|
||||
AssertLSPOptions {'cacheDirectory': expand('$HOME/.cache/cquery')}
|
||||
|
||||
let b:ale_cpp_cquery_cache_directory = '/foo/bar'
|
||||
|
||||
AssertEqual
|
||||
\ {'cacheDirectory': '/foo/bar'},
|
||||
\ ale_linters#cpp#cquery#GetInitializationOptions(bufnr(''))
|
||||
AssertLSPOptions {'cacheDirectory': '/foo/bar'}
|
||||
|
|
|
@ -1,51 +1,26 @@
|
|||
Before:
|
||||
Save g:ale_cpp_flawfinder_executable
|
||||
Save g:ale_cpp_flawfinder_options
|
||||
Save g:ale_cpp_flawfinder_minlevel
|
||||
|
||||
unlet! g:ale_cpp_flawfinder_executable
|
||||
unlet! b:ale_cpp_flawfinder_executable
|
||||
unlet! g:ale_cpp_flawfinder_options
|
||||
unlet! b:ale_cpp_flawfinder_options
|
||||
unlet! g:ale_cpp_flawfinder_minlevel
|
||||
unlet! b:ale_cpp_flawfinder_minlevel
|
||||
|
||||
runtime ale_linters/cpp/flawfinder.vim
|
||||
call ale#assert#SetUpLinterTest('cpp', 'flawfinder')
|
||||
|
||||
After:
|
||||
unlet! b:ale_cpp_flawfinder_executable
|
||||
unlet! b:ale_cpp_flawfinder_options
|
||||
unlet! b:ale_cpp_flawfinder_minlevel
|
||||
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The flawfinder command should be correct):
|
||||
AssertEqual
|
||||
\ ale#Escape('flawfinder')
|
||||
\ . ' -CDQS --minlevel=1 %t',
|
||||
\ ale_linters#cpp#flawfinder#GetCommand(bufnr(''))
|
||||
AssertLinter 'flawfinder',
|
||||
\ ale#Escape('flawfinder') . ' -CDQS --minlevel=1 %t'
|
||||
|
||||
Execute(The minlevel of flawfinder should be configurable):
|
||||
let b:ale_cpp_flawfinder_minlevel = 8
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('flawfinder')
|
||||
\ . ' -CDQS --minlevel=8 %t',
|
||||
\ ale_linters#cpp#flawfinder#GetCommand(bufnr(''))
|
||||
AssertLinter 'flawfinder',
|
||||
\ ale#Escape('flawfinder') . ' -CDQS --minlevel=8 %t'
|
||||
|
||||
Execute(Additional flawfinder options should be configurable):
|
||||
let b:ale_cpp_flawfinder_options = ' --foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('flawfinder')
|
||||
\ . ' -CDQS --foobar --minlevel=1 %t',
|
||||
\ ale_linters#cpp#flawfinder#GetCommand(bufnr(''))
|
||||
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'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foo/bar')
|
||||
\ . ' -CDQS --minlevel=1 %t',
|
||||
\ ale_linters#cpp#flawfinder#GetCommand(bufnr(''))
|
||||
AssertLinter 'foo/bar', ale#Escape('foo/bar') . ' -CDQS --minlevel=1 %t'
|
||||
|
|
|
@ -1,39 +1,16 @@
|
|||
Before:
|
||||
Save g:ale_cpp_gcc_executable
|
||||
Save g:ale_cpp_gcc_options
|
||||
|
||||
unlet! g:ale_cpp_gcc_executable
|
||||
unlet! b:ale_cpp_gcc_executable
|
||||
unlet! g:ale_cpp_gcc_options
|
||||
unlet! b:ale_cpp_gcc_options
|
||||
|
||||
runtime ale_linters/cpp/gcc.vim
|
||||
|
||||
call ale#assert#SetUpLinterTest('cpp', 'gcc')
|
||||
let b:command_tail = ' -S -x c++ -fsyntax-only -iquote'
|
||||
\ . ' ' . ale#Escape(getcwd())
|
||||
\ . ' -std=c++14 -Wall -'
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_cpp_gcc_executable
|
||||
unlet! b:ale_cpp_gcc_options
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'gcc', ale_linters#cpp#gcc#GetExecutable(bufnr(''))
|
||||
AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
|
||||
|
||||
let b:ale_cpp_gcc_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cpp#gcc#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('gcc') . b:command_tail,
|
||||
\ ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
|
||||
|
||||
let b:ale_cpp_gcc_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#cpp#gcc#GetCommand(bufnr(''), [])
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
|
|
@ -1,42 +1,17 @@
|
|||
Before:
|
||||
Save g:ale_cpp_cpplint_executable
|
||||
Save g:ale_cpp_cpplint_options
|
||||
|
||||
unlet! g:ale_cpp_cpplint_executable
|
||||
unlet! b:ale_cpp_cpplint_executable
|
||||
unlet! g:ale_cpp_cpplint_options
|
||||
unlet! b:ale_cpp_cpplint_options
|
||||
|
||||
runtime ale_linters/cpp/cpplint.vim
|
||||
call ale#assert#SetUpLinterTest('cpp', 'cpplint')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_cpp_cpplint_executable
|
||||
unlet! b:ale_cpp_cpplint_options
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'cpplint', ale_linters#cpp#cpplint#GetExecutable(bufnr(''))
|
||||
AssertLinter 'cpplint', ale#Escape('cpplint') . ' %s'
|
||||
|
||||
let b:ale_cpp_cpplint_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cpp#cpplint#GetExecutable(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('cpplint') . ' %s',
|
||||
\ ale_linters#cpp#cpplint#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_cpp_cpplint_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' %s',
|
||||
\ ale_linters#cpp#cpplint#GetCommand(bufnr(''))
|
||||
\
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_cpp_cpplint_options = '--something'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('cpplint') . ' --something %s',
|
||||
\ ale_linters#cpp#cpplint#GetCommand(bufnr(''))
|
||||
AssertLinter 'cpplint', ale#Escape('cpplint') . ' --something %s'
|
||||
|
|
|
@ -1,34 +1,13 @@
|
|||
Before:
|
||||
Save g:ale_cs_mcs_options
|
||||
|
||||
unlet! g:ale_cs_mcs_options
|
||||
|
||||
runtime ale_linters/cs/mcs.vim
|
||||
|
||||
let b:command_tail = ' -unsafe --parse'
|
||||
call ale#assert#SetUpLinterTest('cs', 'mcs')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_cs_mcs_options
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Check for proper default command):
|
||||
|
||||
let b:command = ale_linters#cs#mcs#GetCommand(bufnr(''))
|
||||
let b:command = substitute(b:command,'\s\+',' ','g')
|
||||
|
||||
AssertEqual
|
||||
\ b:command,
|
||||
\ 'mcs -unsafe --parse %t'
|
||||
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'
|
||||
let b:command = ale_linters#cs#mcs#GetCommand(bufnr(''))
|
||||
let b:command = substitute(b:command,'\s\+',' ','g')
|
||||
|
||||
AssertEqual
|
||||
\ b:command,
|
||||
\ 'mcs' . b:command_tail . ' ' . b:ale_cs_mcs_options . ' %t',
|
||||
|
||||
AssertLinter 'mcs', 'mcs -unsafe --parse -pkg:dotnet %t'
|
||||
|
|
|
@ -1,93 +1,47 @@
|
|||
Before:
|
||||
Save g:ale_cs_mcsc_options
|
||||
Save g:ale_cs_mcsc_source
|
||||
Save g:ale_cs_mcsc_assembly_path
|
||||
Save g:ale_cs_mcsc_assemblies
|
||||
Save g:ale_buffer_info
|
||||
|
||||
let g:ale_buffer_info = {bufnr(''): {'temporary_file_list': []}}
|
||||
|
||||
unlet! g:ale_cs_mcsc_options
|
||||
unlet! g:ale_cs_mcsc_source
|
||||
unlet! g:ale_cs_mcsc_assembly_path
|
||||
unlet! g:ale_cs_mcsc_assemblies
|
||||
|
||||
let g:prefix = ' -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
||||
function! GetCommand()
|
||||
let l:command = ale_linters#cs#mcsc#GetCommand(bufnr(''))
|
||||
let l:command = join(split(l:command))
|
||||
|
||||
return substitute(l:command, ':[^ ]\+ -t:module', ':TEMP -t:module', '')
|
||||
endfunction
|
||||
|
||||
runtime ale_linters/cs/mcsc.vim
|
||||
call ale#assert#SetUpLinterTest('cs', 'mcsc')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_cs_mcsc_options
|
||||
unlet! g:ale_cs_mcsc_source
|
||||
unlet! g:ale_cs_mcsc_assembly_path
|
||||
unlet! g:ale_cs_mcsc_assemblies
|
||||
unlet! g:ale_prefix
|
||||
|
||||
delfunction GetCommand
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The mcsc linter should return the correct default command):
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mcs -unsafe' . g:prefix,
|
||||
\ GetCommand()
|
||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
||||
\ . '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'
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mcs -unsafe -pkg:dotnet' . g:prefix,
|
||||
\ GetCommand()
|
||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
||||
\ . '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'
|
||||
|
||||
AssertEqual
|
||||
\ 'cd ' . ale#Escape('../foo/bar') . ' && '
|
||||
\ . 'mcs -unsafe' . g:prefix,
|
||||
\ GetCommand()
|
||||
AssertLinter 'mcs', 'cd ' . ale#Escape('../foo/bar') . ' && '
|
||||
\ . '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']
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mcs -unsafe'
|
||||
\ . ' -lib:' . ale#Escape('/usr/lib/mono') . ',' . ale#Escape('../foo/bar')
|
||||
\ . g:prefix,
|
||||
\ GetCommand()
|
||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
||||
\ . '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 = []
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mcs -unsafe' . g:prefix,
|
||||
\ GetCommand()
|
||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
||||
\ . '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']
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mcs -unsafe'
|
||||
\ . ' -r:' . ale#Escape('foo.dll') . ',' . ale#Escape('bar.dll')
|
||||
\ . g:prefix,
|
||||
\ GetCommand()
|
||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
||||
\ . '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 = []
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mcs -unsafe' . g:prefix,
|
||||
\ GetCommand()
|
||||
AssertLinter 'mcs', 'cd ' . ale#Escape(g:dir) . ' && '
|
||||
\ . 'mcs -unsafe -out:TEMP -t:module -recurse:' . ale#Escape('*.cs')
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
Before:
|
||||
runtime ale_linters/ruby/rubocop.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/')
|
||||
call ale#assert#SetUpLinterTest('cucumber', 'cucumber')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Should require the nearest features dir, if one is found):
|
||||
call ale#test#SetFilename('cucumber_fixtures/features/cuke.feature')
|
||||
call ale#test#SetFilename('../cucumber_fixtures/features/cuke.feature')
|
||||
|
||||
AssertEqual
|
||||
\ 'cucumber --dry-run --quiet --strict --format=json '
|
||||
\ . '-r ' . ale#Escape(ale#path#Simplify(g:dir . '/cucumber_fixtures/features/')) . ' %t',
|
||||
\ ale_linters#cucumber#cucumber#GetCommand(bufnr(''))
|
||||
AssertLinter 'cucumber',
|
||||
\ 'cucumber --dry-run --quiet --strict --format=json '
|
||||
\ . '-r ' . ale#Escape(ale#path#Simplify(g:dir . '/../cucumber_fixtures/features/')) . ' %t'
|
||||
|
||||
Execute(Should require nothing if no features dir is found):
|
||||
call ale#test#SetFilename('something/without/a/features/dir')
|
||||
|
||||
AssertEqual
|
||||
\ 'cucumber --dry-run --quiet --strict --format=json '
|
||||
\ . ' %t',
|
||||
\ ale_linters#cucumber#cucumber#GetCommand(bufnr(''))
|
||||
AssertLinter 'cucumber',
|
||||
\ 'cucumber --dry-run --quiet --strict --format=json %t'
|
||||
|
|
|
@ -1,36 +1,14 @@
|
|||
Before:
|
||||
Save g:ale_cuda_nvcc_executable
|
||||
Save g:ale_cuda_nvcc_options
|
||||
|
||||
unlet! g:ale_cuda_nvcc_executable
|
||||
unlet! b:ale_cuda_nvcc_executable
|
||||
unlet! g:ale_cuda_nvcc_options
|
||||
unlet! b:ale_cuda_nvcc_options
|
||||
|
||||
runtime ale_linters/cuda/nvcc.vim
|
||||
call ale#assert#SetUpLinterTest('cuda', 'nvcc')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:ale_cuda_nvcc_executable
|
||||
unlet! b:ale_cuda_nvcc_options
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'nvcc', ale_linters#cuda#nvcc#GetExecutable(bufnr(''))
|
||||
AssertLinter 'nvcc',
|
||||
\ ale#Escape('nvcc') . ' -cuda -std=c++11 %s -o ' . g:ale#util#nul_file
|
||||
|
||||
let b:ale_cuda_nvcc_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#cuda#nvcc#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('nvcc') . ' -cuda -std=c++11 %s'
|
||||
\ . ' -o ' . g:ale#util#nul_file,
|
||||
\ ale_linters#cuda#nvcc#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_cuda_nvcc_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' -cuda -std=c++11 %s'
|
||||
\ . ' -o ' . g:ale#util#nul_file,
|
||||
\ ale_linters#cuda#nvcc#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' -cuda -std=c++11 %s -o ' . g:ale#util#nul_file
|
||||
|
|
|
@ -1,40 +1,20 @@
|
|||
Before:
|
||||
Save g:ale_dart_dartanalyzer_executable
|
||||
unlet! g:ale_dart_dartanalyzer_executable
|
||||
|
||||
runtime ale_linters/dart/dartanalyzer.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('dart', 'dartanalyzer')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command and executable should be correct):
|
||||
AssertEqual
|
||||
\ 'dartanalyzer',
|
||||
\ ale_linters#dart#dartanalyzer#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('dartanalyzer') . ' %s',
|
||||
\ ale_linters#dart#dartanalyzer#GetCommand(bufnr(''))
|
||||
AssertLinter 'dartanalyzer', ale#Escape('dartanalyzer') . ' %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_dart_dartanalyzer_executable = '/usr/lib/dart/bin/dartanalyzer'
|
||||
let g:ale_dart_dartanalyzer_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ '/usr/lib/dart/bin/dartanalyzer',
|
||||
\ ale_linters#dart#dartanalyzer#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('/usr/lib/dart/bin/dartanalyzer') . ' %s',
|
||||
\ ale_linters#dart#dartanalyzer#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
||||
|
||||
Execute(The .packages file should be set if detected):
|
||||
call ale#test#SetFilename('dart_paths/foo')
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('dartanalyzer')
|
||||
AssertLinter 'dartanalyzer', ale#Escape('dartanalyzer')
|
||||
\ . ' --packages ' . ale#Escape(ale#path#Simplify(g:dir . '/dart_paths/.packages'))
|
||||
\ . ' %s',
|
||||
\ ale_linters#dart#dartanalyzer#GetCommand(bufnr(''))
|
||||
\ . ' %s'
|
||||
|
|
|
@ -1,37 +1,19 @@
|
|||
Before:
|
||||
runtime ale_linters/elixir/mix.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
let g:project_root = ale#path#Simplify(g:dir . '/mix_paths/wrapped_project')
|
||||
call ale#assert#SetUpLinterTest('elixir', 'mix')
|
||||
|
||||
let g:env_prefix = has('win32')
|
||||
\ ? 'set MIX_BUILD_PATH=TEMP && '
|
||||
\ : 'MIX_BUILD_PATH=TEMP '
|
||||
|
||||
|
||||
function! GetCommand(buffer) abort
|
||||
let l:command = ale_linters#elixir#mix#GetCommand(a:buffer)
|
||||
|
||||
return substitute(l:command, 'MIX_BUILD_PATH=[^ ]\+', 'MIX_BUILD_PATH=TEMP', '')
|
||||
endfunction
|
||||
\ ? 'set MIX_BUILD_PATH=' . ale#Escape('TEMP_DIR') . ' && '
|
||||
\ : 'MIX_BUILD_PATH=' . ale#Escape('TEMP_DIR') . ' '
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:env_prefix
|
||||
unlet! g:project_root
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
delfunction GetCommand
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default mix command should be correct):
|
||||
call ale#test#SetFilename('mix_paths/wrapped_project/lib/app.ex')
|
||||
|
||||
AssertEqual
|
||||
\ GetCommand(bufnr('')),
|
||||
\ ale#path#CdString(g:project_root)
|
||||
AssertLinter 'mix',
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/mix_paths/wrapped_project'))
|
||||
\ . g:env_prefix
|
||||
\ . 'mix compile %s'
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
Before:
|
||||
runtime ale_linters/eruby/erb.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('eruby', 'erb')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should not contain any filter code by default):
|
||||
call ale#test#SetFilename('../ruby_fixtures/not_a_rails_app/file.rb')
|
||||
|
||||
AssertEqual
|
||||
\ 'erb -P -T - -x %t | ruby -c',
|
||||
\ ale_linters#eruby#erb#GetCommand(bufnr(''))
|
||||
AssertLinter 'erb', 'erb -P -T - -x %t | ruby -c'
|
||||
|
||||
Execute(Executable should filter invalid eRuby when inside a Rails project):
|
||||
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/app/views/my_great_view.html.erb')
|
||||
|
||||
AssertEqual
|
||||
\ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c',
|
||||
\ ale_linters#eruby#erb#GetCommand(bufnr(''))
|
||||
AssertLinter 'erb',
|
||||
\ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||
|
|
|
@ -1,66 +1,45 @@
|
|||
Before:
|
||||
Save g:ale_erlang_syntaxerl_executable
|
||||
|
||||
unlet! g:ale_erlang_syntaxerl_executable
|
||||
unlet! b:ale_erlang_syntaxerl_executable
|
||||
|
||||
runtime ale_linters/erlang/syntaxerl.vim
|
||||
call ale#assert#SetUpLinterTest('erlang', 'syntaxerl')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
call ale#linter#Reset()
|
||||
Execute (The default commands should be correct):
|
||||
AssertLinter 'syntaxerl', [
|
||||
\ ale#Escape('syntaxerl') . ' -h',
|
||||
\ ale#Escape('syntaxerl') . ' %t',
|
||||
\]
|
||||
|
||||
Execute (The executable should be correct):
|
||||
AssertEqual 'syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))
|
||||
Execute (The executable should be configurable):
|
||||
let b:ale_erlang_syntaxerl_executable = 'foobar'
|
||||
|
||||
let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
|
||||
AssertEqual '/some/other/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))
|
||||
|
||||
let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
|
||||
AssertEqual '/yet/another/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr(''))
|
||||
|
||||
|
||||
Execute (The executable should be presented in the feature check command):
|
||||
let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('/some/other/syntaxerl') . ' -h',
|
||||
\ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))
|
||||
|
||||
let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('/yet/another/syntaxerl') . ' -h',
|
||||
\ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr(''))
|
||||
|
||||
Execute (The executable should be presented in the command):
|
||||
let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('/some/other/syntaxerl') . ' %t',
|
||||
\ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])
|
||||
|
||||
let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('/yet/another/syntaxerl') . ' %t',
|
||||
\ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [])
|
||||
AssertLinter 'foobar', [
|
||||
\ ale#Escape('foobar') . ' -h',
|
||||
\ ale#Escape('foobar') . ' %t',
|
||||
\]
|
||||
|
||||
Execute (The -b option should be used when available):
|
||||
AssertEqual ale#Escape('syntaxerl') . ' %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
|
||||
\ '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',
|
||||
\ ])
|
||||
WithChainResults [
|
||||
\ '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',
|
||||
\]
|
||||
|
||||
AssertEqual ale#Escape('syntaxerl') . ' -b %s %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [
|
||||
\ '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',
|
||||
\ ])
|
||||
WithChainResults [
|
||||
\ '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',
|
||||
\]
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
Before:
|
||||
runtime ale_linters/eruby/erubi.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('eruby', 'erubi')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should not contain any filter code by default):
|
||||
call ale#test#SetFilename('../ruby_fixtures/not_a_rails_app/file.rb')
|
||||
|
||||
AssertEqual
|
||||
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',
|
||||
\ ale_linters#eruby#erubi#GetCommand(bufnr(''), [])
|
||||
\]
|
||||
|
||||
Execute(Executable should filter invalid eRuby when inside a Rails project):
|
||||
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/app/views/my_great_view.html.erb')
|
||||
|
||||
AssertEqual
|
||||
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',
|
||||
\ ale_linters#eruby#erubi#GetCommand(bufnr(''), [])
|
||||
|
||||
Execute(Command should be blank if the first command in the chain return output):
|
||||
let output_lines = [
|
||||
\ "/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'",
|
||||
\]
|
||||
|
||||
AssertEqual
|
||||
Execute(Command should be blank if the first command in the chain returns output):
|
||||
WithChainResults [
|
||||
\ "/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('""'),
|
||||
\ '',
|
||||
\ ale_linters#eruby#erubi#GetCommand(bufnr(''), output_lines)
|
||||
\]
|
||||
|
|
|
@ -1,21 +1,16 @@
|
|||
Before:
|
||||
runtime ale_linters/eruby/erubis.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('eruby', 'erubis')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should not contain any filter code by default):
|
||||
call ale#test#SetFilename('../ruby_fixtures/not_a_rails_app/file.rb')
|
||||
|
||||
AssertEqual
|
||||
\ 'erubis -x %t | ruby -c',
|
||||
\ ale_linters#eruby#erubis#GetCommand(bufnr(''))
|
||||
AssertLinter 'erubis', 'erubis -x %t | ruby -c'
|
||||
|
||||
Execute(Executable should filter invalid eRuby when inside a Rails project):
|
||||
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/app/views/my_great_view.html.erb')
|
||||
|
||||
AssertEqual
|
||||
\ 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c',
|
||||
\ ale_linters#eruby#erubis#GetCommand(bufnr(''))
|
||||
AssertLinter 'erubis',
|
||||
\ 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c'
|
||||
|
|
|
@ -1,91 +1,75 @@
|
|||
Before:
|
||||
Save g:ale_python_flake8_executable
|
||||
Save g:ale_python_flake8_options
|
||||
Save g:ale_python_flake8_use_global
|
||||
Save g:ale_python_flake8_change_directory
|
||||
|
||||
unlet! g:ale_python_flake8_executable
|
||||
unlet! g:ale_python_flake8_args
|
||||
unlet! g:ale_python_flake8_options
|
||||
unlet! g:ale_python_flake8_use_global
|
||||
unlet! g:ale_python_flake8_change_directory
|
||||
|
||||
call ale#assert#SetUpLinterTest('python', 'flake8')
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
runtime ale_linters/python/flake8.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
WithChainResults ['3.0.0']
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:ale_python_flake8_args
|
||||
|
||||
unlet! b:bin_dir
|
||||
unlet! b:executable
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#semver#ResetVersionCache()
|
||||
unlet! b:bin_dir
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The flake8 callbacks should return the correct default values):
|
||||
AssertEqual
|
||||
\ 'flake8',
|
||||
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
|
||||
\]
|
||||
|
||||
" The version check should be cached.
|
||||
WithChainResults []
|
||||
AssertLinter 'flake8', [
|
||||
\ '',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
" Try with older versions.
|
||||
call ale#semver#ResetVersionCache()
|
||||
AssertEqual
|
||||
WithChainResults ['2.9.9']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('flake8') . ' --format=default -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
|
||||
\]
|
||||
|
||||
Execute(The option for disabling changing directories should work):
|
||||
let g:ale_python_flake8_change_directory = 0
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#Escape('flake8') . ' --format=default --stdin-display-name %s -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
|
||||
\]
|
||||
|
||||
Execute(The flake8 command callback should let you set options):
|
||||
let g:ale_python_flake8_options = '--some-option'
|
||||
|
||||
AssertEqual
|
||||
WithChainResults ['3.0.4']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('flake8')
|
||||
\ . ' --some-option --format=default'
|
||||
\ . ' --stdin-display-name %s -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.4'])
|
||||
\ . ale#Escape('flake8') . ' --some-option'
|
||||
\ . ' --format=default --stdin-display-name %s -',
|
||||
\]
|
||||
|
||||
call ale#semver#ResetVersionCache()
|
||||
|
||||
AssertEqual
|
||||
WithChainResults ['2.9.9']
|
||||
AssertLinter 'flake8', [
|
||||
\ ale#Escape('flake8') . ' --version',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('flake8')
|
||||
\ . ' --some-option --format=default -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
|
||||
\ . ale#Escape('flake8') . ' --some-option --format=default -',
|
||||
\]
|
||||
|
||||
Execute(You should be able to set a custom executable and it should be escaped):
|
||||
let g:ale_python_flake8_executable = 'executable with spaces'
|
||||
|
||||
AssertEqual
|
||||
\ 'executable with spaces',
|
||||
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter 'executable with spaces', [
|
||||
\ ale#Escape('executable with spaces') . ' --version',
|
||||
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('executable with spaces')
|
||||
\ . ' --format=default'
|
||||
\ . ' --stdin-display-name %s -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
|
||||
\]
|
||||
|
||||
Execute(The flake8 callbacks should detect virtualenv directories):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
|
@ -94,17 +78,13 @@ Execute(The flake8 callbacks should detect virtualenv directories):
|
|||
\ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/flake8'
|
||||
\)
|
||||
|
||||
AssertEqual
|
||||
\ b:executable,
|
||||
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter b:executable, [
|
||||
\ ale#Escape(b:executable) . ' --version',
|
||||
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape(b:executable)
|
||||
\ . ' --format=default --stdin-display-name %s -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
|
||||
\ . 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):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/namespace_package_manifest/namespace/foo/bar.py')
|
||||
|
@ -148,37 +128,32 @@ Execute(Using `python -m flake8` should be supported for running flake8):
|
|||
let g:ale_python_flake8_executable = 'python'
|
||||
let g:ale_python_flake8_options = '-m flake8 --some-option'
|
||||
|
||||
AssertEqual
|
||||
\ 'python',
|
||||
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
WithChainResults ['2.9.9']
|
||||
AssertLinter 'python', [
|
||||
\ ale#Escape('python') . ' -m flake8 --version',
|
||||
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('python') . ' -m flake8 --some-option --format=default -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
|
||||
\ . 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'
|
||||
|
||||
AssertEqual
|
||||
\ 'python',
|
||||
\ ale_linters#python#flake8#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
WithChainResults ['2.9.9']
|
||||
AssertLinter 'python', [
|
||||
\ ale#Escape('python') . ' -m flake8 --version',
|
||||
\ ale_linters#python#flake8#VersionCheck(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('python') . ' -m flake8 --some-option --format=default -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['2.9.9'])
|
||||
\ . ale#Escape('python')
|
||||
\ . ' -m flake8 --some-option --format=default -'
|
||||
\]
|
||||
|
||||
Execute(Setting executable to 'pipenv' appends 'run flake8'):
|
||||
Execute(Setting executable to 'pipenv' should append 'run flake8'):
|
||||
let g:ale_python_flake8_executable = 'path/to/pipenv'
|
||||
|
||||
AssertEqual
|
||||
" FIXME: pipenv should check the vresion with flake8.
|
||||
WithChainResults []
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('path/to/pipenv') . ' run flake8 --format=default --stdin-display-name %s -',
|
||||
\ ale_linters#python#flake8#GetCommand(bufnr(''), ['3.0.0'])
|
||||
\ . ale#Escape('path/to/pipenv') . ' run flake8 --format=default -'
|
||||
|
|
|
@ -1,44 +1,18 @@
|
|||
Before:
|
||||
Save g:ale_chef_foodcritic_executable
|
||||
Save g:ale_chef_foodcritic_options
|
||||
|
||||
unlet! g:ale_chef_foodcritic_executable
|
||||
unlet! g:ale_chef_foodcritic_options
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test')
|
||||
|
||||
runtime ale_linters/chef/foodcritic.vim
|
||||
call ale#assert#SetUpLinterTest('chef', 'foodcritic')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_chef_foodcritic_executable
|
||||
unlet! b:ale_chef_foodcritic_options
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual
|
||||
\ 'foodcritic',
|
||||
\ ale_linters#chef#foodcritic#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('foodcritic') . ' %s',
|
||||
\ ale_linters#chef#foodcritic#GetCommand(bufnr(''))
|
||||
AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' %s'
|
||||
|
||||
Execute(Extra options should be included with escapeed tildes (~)):
|
||||
let b:ale_chef_foodcritic_options = '-t ~F011'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foodcritic') . ' -t \~F011 %s',
|
||||
\ ale_linters#chef#foodcritic#GetCommand(bufnr(''))
|
||||
AssertLinter 'foodcritic', ale#Escape('foodcritic') . ' -t \~F011 %s'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_chef_foodcritic_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ 'foobar',
|
||||
\ ale_linters#chef#foodcritic#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' %s',
|
||||
\ ale_linters#chef#foodcritic#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
Before:
|
||||
runtime ale_linters/scala/fsc.vim
|
||||
call ale#assert#SetUpLinterTest('scala', 'fsc')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Given scala(An empty Scala file):
|
||||
Execute(The default executable and command should be correct):
|
||||
AssertEqual 'fsc', ale_linters#scala#fsc#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('fsc') . ' -Ystop-after:parser %t',
|
||||
\ ale_linters#scala#fsc#GetCommand(bufnr(''))
|
||||
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):
|
||||
AssertEqual '', ale_linters#scala#fsc#GetExecutable(bufnr(''))
|
||||
AssertEqual '', ale_linters#scala#fsc#GetCommand(bufnr(''))
|
||||
AssertLinter '', ''
|
||||
|
|
|
@ -1,34 +1,19 @@
|
|||
Before:
|
||||
Save g:ale_fuse_fusionlint_options
|
||||
Save g:ale_fuse_fusionlint_executable
|
||||
|
||||
unlet! g:ale_fuse_fusionlint_options
|
||||
unlet! g:ale_fuse_fusionlint_executable
|
||||
|
||||
runtime ale_linters/fuse/fusionlint.vim
|
||||
call ale#assert#SetUpLinterTest('fuse', 'fusionlint')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The fuse fusionlint command callback should return the correct default string):
|
||||
AssertEqual ale#Escape('fusion-lint') . ' --filename %s -i',
|
||||
\ join(split(ale_linters#fuse#fusionlint#GetCommand(1)))
|
||||
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'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('fusion-lint')
|
||||
\ . ' --example-option argument --filename %s -i',
|
||||
\ join(split(ale_linters#fuse#fusionlint#GetCommand(1)))
|
||||
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 = 'util/linter.fuse'
|
||||
let g:ale_fuse_fusionlint_executable = 'foobar'
|
||||
|
||||
AssertEqual 'util/linter.fuse', ale_linters#fuse#fusionlint#GetExecutable(1)
|
||||
AssertEqual
|
||||
\ ale#Escape('util/linter.fuse')
|
||||
\ . ' --filename %s -i',
|
||||
\ join(split(ale_linters#fuse#fusionlint#GetCommand(1)))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --filename %s -i'
|
||||
|
|
|
@ -1,40 +1,25 @@
|
|||
Before:
|
||||
Save g:ale_awk_gawk_executable
|
||||
Save g:ale_awk_gawk_options
|
||||
unlet! g:ale_awk_gawk_executable
|
||||
unlet! g:ale_awk_gawk_options
|
||||
|
||||
runtime ale_linters/awk/gawk.vim
|
||||
call ale#assert#SetUpLinterTest('awk', 'gawk')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_awk_gawk_executable
|
||||
unlet! b:ale_awk_gawk_options
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ 'gawk'
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' ' . '-f %t --lint /dev/null',
|
||||
\ ale_linters#awk#gawk#GetCommand(bufnr(''))
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'gawk',
|
||||
\ ale#Escape('gawk') . ' --source ''BEGIN { exit } END { exit 1 }'''
|
||||
\ . ' -f %t --lint /dev/null'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_awk_gawk_executable = '/other/gawk'
|
||||
|
||||
AssertEqual
|
||||
\ '/other/gawk'
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' ' . '-f %t --lint /dev/null',
|
||||
\ ale_linters#awk#gawk#GetCommand(bufnr(''))
|
||||
AssertLinter '/other/gawk',
|
||||
\ ale#Escape('/other/gawk') . ' --source ''BEGIN { exit } END { exit 1 }'''
|
||||
\ . ' -f %t --lint /dev/null'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_awk_gawk_executable = 'gawk'
|
||||
let b:ale_awk_gawk_options = '--something'
|
||||
|
||||
AssertEqual
|
||||
\ 'gawk'
|
||||
\ . " --source 'BEGIN { exit } END { exit 1 }'"
|
||||
\ . ' --something'
|
||||
\ . ' ' . '-f %t --lint /dev/null',
|
||||
\ ale_linters#awk#gawk#GetCommand(bufnr(''))
|
||||
AssertLinter 'gawk',
|
||||
\ ale#Escape('gawk') . ' --source ''BEGIN { exit } END { exit 1 }'''
|
||||
\ . ' --something -f %t --lint /dev/null'
|
||||
|
|
|
@ -1,31 +1,24 @@
|
|||
Before:
|
||||
runtime ale_linters/fortran/gcc.vim
|
||||
call ale#assert#SetUpLinterTest('fortran', 'gcc')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
let g:ale_fortran_gcc_options = '-Wall'
|
||||
let g:ale_fortran_gcc_use_free_form = 1
|
||||
let g:ale_fortran_gcc_executable = 'gcc'
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The fortran gcc command callback should return the correct default string):
|
||||
AssertEqual 'gcc -S -x f95 -fsyntax-only -ffree-form -Wall -',
|
||||
\ join(split(ale_linters#fortran#gcc#GetCommand(1)))
|
||||
AssertLinter 'gcc', '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'
|
||||
|
||||
AssertEqual 'gcc -S -x f95 -fsyntax-only -ffree-form -Wotherthings -',
|
||||
\ join(split(ale_linters#fortran#gcc#GetCommand(1)))
|
||||
AssertLinter 'gcc', '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
|
||||
|
||||
AssertEqual 'gcc -S -x f95 -fsyntax-only -ffixed-form -Wall -',
|
||||
\ join(split(ale_linters#fortran#gcc#GetCommand(1)))
|
||||
AssertLinter 'gcc', 'gcc -S -x f95 -fsyntax-only -ffixed-form -Wall -'
|
||||
|
||||
Execute(The fortran executable should be configurable):
|
||||
let g:ale_fortran_gcc_executable = 'gfortran'
|
||||
|
||||
AssertEqual 'gfortran', ale_linters#fortran#gcc#GetExecutable(1)
|
||||
AssertEqual 'gfortran -S -x f95 -fsyntax-only -ffree-form -Wall -',
|
||||
\ join(split(ale_linters#fortran#gcc#GetCommand(1)))
|
||||
AssertLinter 'gfortran',
|
||||
\ 'gfortran -S -x f95 -fsyntax-only -ffree-form -Wall -'
|
||||
|
|
|
@ -1,84 +1,43 @@
|
|||
Before:
|
||||
Save g:ale_gitcommit_gitlint_executable
|
||||
Save g:ale_gitcommit_gitlint_options
|
||||
Save g:ale_gitcommit_gitlint_use_global
|
||||
|
||||
unlet! g:ale_gitcommit_gitlint_executable
|
||||
unlet! g:ale_gitcommit_gitlint_options
|
||||
unlet! g:ale_gitcommit_gitlint_use_global
|
||||
|
||||
runtime ale_linters/gitcommit/gitlint.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('gitcommit', 'gitlint')
|
||||
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
let b:command_tail = ' lint'
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
unlet! b:bin_dir
|
||||
unlet! b:executable
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The gitlint callbacks should return the correct default values):
|
||||
AssertEqual
|
||||
\ 'gitlint',
|
||||
\ ale_linters#gitcommit#gitlint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('gitlint') . b:command_tail,
|
||||
\ ale_linters#gitcommit#gitlint#GetCommand(bufnr(''))
|
||||
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'
|
||||
|
||||
AssertEqual
|
||||
\ 'executable with spaces',
|
||||
\ ale_linters#gitcommit#gitlint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('executable with spaces') . b:command_tail,
|
||||
\ ale_linters#gitcommit#gitlint#GetCommand(bufnr(''))
|
||||
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'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('gitlint') . ' --some-option' . b:command_tail,
|
||||
\ ale_linters#gitcommit#gitlint#GetCommand(bufnr(''))
|
||||
AssertLinter 'gitlint', ale#Escape('gitlint') . ' --some-option lint'
|
||||
|
||||
Execute(The gitlint callbacks shouldn't detect virtualenv directories where they don't exist):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
call ale#test#SetFilename('python_paths/no_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
|
||||
AssertEqual
|
||||
\ 'gitlint',
|
||||
\ ale_linters#gitcommit#gitlint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('gitlint') . b:command_tail,
|
||||
\ ale_linters#gitcommit#gitlint#GetCommand(bufnr(''))
|
||||
AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint'
|
||||
|
||||
Execute(The gitlint callbacks should detect virtualenv directories):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
|
||||
call ale#test#SetFilename('python_paths/with_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/gitlint'
|
||||
\)
|
||||
|
||||
AssertEqual
|
||||
\ b:executable,
|
||||
\ ale_linters#gitcommit#gitlint#GetExecutable(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape(b:executable) . b:command_tail,
|
||||
\ ale_linters#gitcommit#gitlint#GetCommand(bufnr(''))
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' lint'
|
||||
|
||||
Execute(You should able able to use the global gitlint instead):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
call ale#test#SetFilename('python_paths/with_virtualenv/subdir/foo/COMMIT_EDITMSG')
|
||||
let g:ale_gitcommit_gitlint_use_global = 1
|
||||
|
||||
AssertEqual
|
||||
\ 'gitlint',
|
||||
\ ale_linters#gitcommit#gitlint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('gitlint') . b:command_tail,
|
||||
\ ale_linters#gitcommit#gitlint#GetCommand(bufnr(''))
|
||||
AssertLinter 'gitlint', ale#Escape('gitlint') . ' lint'
|
||||
|
|
|
@ -1,40 +1,19 @@
|
|||
Before:
|
||||
Save g:ale_glsl_glslang_executable
|
||||
Save g:ale_glsl_glslang_options
|
||||
|
||||
unlet! g:ale_glsl_glslang_executable
|
||||
unlet! g:ale_glsl_glslang_options
|
||||
|
||||
runtime ale_linters/glsl/glslang.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('glsl', 'glslang')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to glslangValidator):
|
||||
AssertEqual
|
||||
\ 'glslangValidator',
|
||||
\ ale_linters#glsl#glslang#GetExecutable(bufnr(''))
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'glslangValidator', ale#Escape('glslangValidator') . ' -C %t'
|
||||
|
||||
Execute(Executable should be configurable):
|
||||
let g:ale_glsl_glslang_executable = 'foobar'
|
||||
AssertEqual
|
||||
\ 'foobar',
|
||||
\ ale_linters#glsl#glslang#GetExecutable(bufnr(''))
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_glsl_glslang_executable = 'foobar'
|
||||
|
||||
Execute(Command should use executable):
|
||||
AssertEqual
|
||||
\ 'glslangValidator -C %t',
|
||||
\ ale_linters#glsl#glslang#GetCommand(bufnr(''))
|
||||
|
||||
let g:ale_glsl_glslang_executable = 'foobar'
|
||||
AssertEqual
|
||||
\ 'foobar -C %t',
|
||||
\ ale_linters#glsl#glslang#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' -C %t'
|
||||
|
||||
Execute(Options should work):
|
||||
let g:ale_glsl_glslang_options = '--test'
|
||||
AssertEqual
|
||||
\ 'glslangValidator --test -C %t',
|
||||
\ ale_linters#glsl#glslang#GetCommand(bufnr(''))
|
||||
|
||||
AssertLinter 'glslangValidator',
|
||||
\ ale#Escape('glslangValidator') . ' --test -C %t'
|
||||
|
|
|
@ -1,37 +1,19 @@
|
|||
Before:
|
||||
Save g:ale_glsl_glslls_executable
|
||||
Save g:ale_glsl_glslls_logfile
|
||||
|
||||
unlet! g:ale_glsl_glslls_executable
|
||||
unlet! g:ale_glsl_glslls_logfile
|
||||
|
||||
runtime ale_linters/glsl/glslls.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('glsl', 'glslls')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to 'glslls'):
|
||||
AssertEqual
|
||||
\ 'glslls',
|
||||
\ ale_linters#glsl#glslls#GetExecutable(bufnr(''))
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'glslls', ale#Escape('glslls') . ' --stdin'
|
||||
|
||||
Execute(Executable should be configurable):
|
||||
let g:ale_glsl_glslls_executable = 'foobar'
|
||||
AssertEqual
|
||||
\ 'foobar',
|
||||
\ ale_linters#glsl#glslls#GetExecutable(bufnr(''))
|
||||
let b:ale_glsl_glslls_executable = 'foobar'
|
||||
|
||||
Execute(Command should use executable):
|
||||
let command1 = ale_linters#glsl#glslls#GetCommand(bufnr(''))
|
||||
AssertEqual command1, ale#Escape('glslls') . ' --stdin'
|
||||
|
||||
let g:ale_glsl_glslls_executable = 'foobar'
|
||||
let command2 = ale_linters#glsl#glslls#GetCommand(bufnr(''))
|
||||
AssertEqual command2, ale#Escape('foobar') . ' --stdin'
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin'
|
||||
|
||||
Execute(Setting logfile should work):
|
||||
let g:ale_glsl_glslls_logfile = '/tmp/test.log'
|
||||
let command = ale_linters#glsl#glslls#GetCommand(bufnr(''))
|
||||
AssertEqual command, ale#Escape('glslls') . ' --verbose -l /tmp/test.log --stdin'
|
||||
let b:ale_glsl_glslls_logfile = '/tmp/test.log'
|
||||
|
||||
AssertLinter 'glslls',
|
||||
\ ale#Escape('glslls') . ' --verbose -l /tmp/test.log --stdin'
|
||||
|
|
|
@ -1,52 +1,36 @@
|
|||
Before:
|
||||
Save g:ale_go_gobuild_options
|
||||
|
||||
unlet! g:ale_go_gobuild_options
|
||||
call ale#assert#SetUpLinterTest('go', 'gobuild')
|
||||
|
||||
let g:env_prefix = has('win32')
|
||||
\ ? 'set GOPATH=' . ale#Escape('/foo/bar') . ' && '
|
||||
\ : 'GOPATH=' . ale#Escape('/foo/bar') . ' '
|
||||
|
||||
runtime ale_linters/go/gobuild.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
call ale_linters#go#gobuild#ResetEnv()
|
||||
|
||||
WithChainResults ['/foo/bar', '/foo/baz']
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:env_prefix
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The default gobuild command should be correct):
|
||||
AssertEqual
|
||||
\ ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz']),
|
||||
Execute(The default commands should be correct):
|
||||
AssertLinter 'go', [
|
||||
\ 'go env GOPATH GOROOT',
|
||||
\ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . 'go test -c -o /dev/null ./'
|
||||
|
||||
Execute(The command for getting GOPATH should be correct):
|
||||
AssertEqual ale_linters#go#gobuild#GoEnv(bufnr('')), 'go env GOPATH GOROOT'
|
||||
|
||||
call ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz'])
|
||||
\]
|
||||
|
||||
" We shouldn't run `go env` many times after we've got it.
|
||||
AssertEqual ale_linters#go#gobuild#GoEnv(bufnr('')), ''
|
||||
|
||||
Execute(The GOPATH output should be used after it has been read once):
|
||||
call ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz'])
|
||||
|
||||
AssertEqual
|
||||
\ ale_linters#go#gobuild#GetCommand(bufnr(''), []),
|
||||
AssertLinter 'go', [
|
||||
\ '',
|
||||
\ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . 'go test -c -o /dev/null ./'
|
||||
\]
|
||||
|
||||
Execute(Extra options should be supported):
|
||||
let g:ale_go_gobuild_options = '--foo-bar'
|
||||
|
||||
AssertEqual
|
||||
\ ale_linters#go#gobuild#GetCommand(bufnr(''), ['/foo/bar', '/foo/baz']),
|
||||
AssertLinter 'go', [
|
||||
\ 'go env GOPATH GOROOT',
|
||||
\ g:env_prefix . 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . 'go test --foo-bar -c -o /dev/null ./'
|
||||
\]
|
||||
|
|
|
@ -1,61 +1,38 @@
|
|||
Before:
|
||||
Save b:ale_go_gometalinter_executable
|
||||
Save b:ale_go_gometalinter_options
|
||||
Save b:ale_go_gometalinter_lint_package
|
||||
|
||||
let b:ale_go_gometalinter_executable = 'gometalinter'
|
||||
let b:ale_go_gometalinter_options = ''
|
||||
let b:ale_go_gometalinter_lint_package = 0
|
||||
|
||||
runtime ale_linters/go/gometalinter.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('go', 'gometalinter')
|
||||
call ale#test#SetFilename('test.go')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The gometalinter callback should return the right defaults):
|
||||
AssertEqual
|
||||
\ 'gometalinter',
|
||||
\ ale_linters#go#gometalinter#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
Execute(The gometalinter defaults should be correct):
|
||||
AssertLinter 'gometalinter',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' .',
|
||||
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
||||
\ . ' .'
|
||||
|
||||
Execute(The gometalinter callback should use a configured executable):
|
||||
let b:ale_go_gometalinter_executable = 'something else'
|
||||
|
||||
AssertEqual
|
||||
\ 'something else',
|
||||
\ ale_linters#go#gometalinter#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter 'something else',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ale#Escape('something else')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' .',
|
||||
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
||||
\ . ' .'
|
||||
|
||||
Execute(The gometalinter callback should use configured options):
|
||||
let b:ale_go_gometalinter_options = '--foobar'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'gometalinter',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ale#Escape('gometalinter')
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
||||
\ . ' --foobar' . ' .',
|
||||
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
||||
\ . ' --foobar' . ' .'
|
||||
|
||||
Execute(The gometalinter `lint_package` option should use the correct command):
|
||||
let b:ale_go_gometalinter_lint_package = 1
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'gometalinter',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ale#Escape('gometalinter') . ' .',
|
||||
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
||||
\ . ale#Escape('gometalinter') . ' .'
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
Before:
|
||||
runtime ale_linters/go/gosimple.vim
|
||||
call ale#assert#SetUpLinterTest('go', 'gosimple')
|
||||
call ale#test#SetFilename('../go_files/testfile2.go')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default gosimple command should be correct):
|
||||
AssertEqual 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ' gosimple .',
|
||||
\ ale_linters#go#gosimple#GetCommand(bufnr(''))
|
||||
|
||||
AssertLinter 'gosimple',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && gosimple .'
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
Before:
|
||||
runtime ale_linters/go/gotype.vim
|
||||
call ale#assert#SetUpLinterTest('go', 'gotype')
|
||||
call ale#test#SetFilename('../go_files/testfile2.go')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default gotype command should be correct):
|
||||
AssertEqual 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ' gotype .',
|
||||
\ ale_linters#go#gotype#GetCommand(bufnr(''))
|
||||
AssertLinter 'gotype',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && gotype .'
|
||||
|
||||
Execute(The gotype callback should ignore test files):
|
||||
call ale#test#SetFilename('bla_test.go')
|
||||
AssertEqual 0, ale_linters#go#gotype#GetCommand(bufnr(''))
|
||||
|
||||
AssertLinter 'gotype', ''
|
||||
|
|
|
@ -1,16 +1,8 @@
|
|||
Before:
|
||||
runtime ale_linters/go/govet.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('go', 'govet')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ' go vet .',
|
||||
\ ale_linters#go#govet#GetCommand(bufnr(''))
|
||||
AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .'
|
||||
|
|
|
@ -1,72 +1,37 @@
|
|||
Before:
|
||||
runtime ale_linters/haml/hamllint.vim
|
||||
call ale#assert#SetUpLinterTest('haml', 'hamllint')
|
||||
|
||||
let g:default_command = 'haml-lint %t'
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:default_command
|
||||
unlet! b:conf
|
||||
unlet! b:conf_hamllint
|
||||
unlet! b:conf_rubocop
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual g:default_command, ale_linters#haml#hamllint#GetCommand(bufnr(''))
|
||||
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('../hamllint-test-files/rubocop-yml/subdir/file.haml')
|
||||
let b:conf = ale#path#Simplify(g:dir . '/../hamllint-test-files/rubocop-yml/.rubocop.yml')
|
||||
|
||||
if has('win32')
|
||||
" Windows uses 'set var=... && command'
|
||||
AssertEqual
|
||||
\ 'set HAML_LINT_RUBOCOP_CONF='
|
||||
\ . ale#Escape(b:conf)
|
||||
\ . ' && ' . g:default_command,
|
||||
\ ale_linters#haml#hamllint#GetCommand(bufnr(''))
|
||||
else
|
||||
" Unix uses 'var=... command'
|
||||
AssertEqual
|
||||
\ 'HAML_LINT_RUBOCOP_CONF='
|
||||
\ . ale#Escape(b:conf)
|
||||
\ . ' ' . g:default_command,
|
||||
\ ale_linters#haml#hamllint#GetCommand(bufnr(''))
|
||||
endif
|
||||
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('../hamllint-test-files/haml-lint-yml/subdir/file.haml')
|
||||
let b:conf = ale#path#Simplify(g:dir . '/../hamllint-test-files/haml-lint-yml/.haml-lint.yml')
|
||||
|
||||
AssertEqual
|
||||
\ 'haml-lint --config '
|
||||
\ . ale#Escape(b:conf)
|
||||
\ . ' %t',
|
||||
\ ale_linters#haml#hamllint#GetCommand(bufnr(''))
|
||||
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('../hamllint-test-files/haml-lint-and-rubocop/subdir/file.haml')
|
||||
let b:conf_hamllint = ale#path#Simplify(g:dir . '/../hamllint-test-files/haml-lint-and-rubocop/.haml-lint.yml')
|
||||
let b:conf_rubocop = ale#path#Simplify(g:dir . '/../hamllint-test-files/haml-lint-and-rubocop/.rubocop.yml')
|
||||
|
||||
if has('win32')
|
||||
" Windows uses 'set var=... && command'
|
||||
AssertEqual
|
||||
\ 'set HAML_LINT_RUBOCOP_CONF='
|
||||
\ . ale#Escape(b:conf_rubocop)
|
||||
\ . ' && haml-lint --config '
|
||||
\ . ale#Escape(b:conf_hamllint)
|
||||
\ . ' %t',
|
||||
\ ale_linters#haml#hamllint#GetCommand(bufnr(''))
|
||||
else
|
||||
" Unix uses 'var=... command'
|
||||
AssertEqual
|
||||
\ 'HAML_LINT_RUBOCOP_CONF='
|
||||
\ . ale#Escape(b:conf_rubocop)
|
||||
\ . ' haml-lint --config '
|
||||
\ . ale#Escape(b:conf_hamllint)
|
||||
\ . ' %t',
|
||||
\ ale_linters#haml#hamllint#GetCommand(bufnr(''))
|
||||
endif
|
||||
AssertLinter 'haml-lint',
|
||||
\ ale#Env('HAML_LINT_RUBOCOP_CONF', b:conf_rubocop)
|
||||
\ . 'haml-lint --config ' . ale#Escape(b:conf_hamllint) . ' %t'
|
||||
|
|
|
@ -1,23 +1,12 @@
|
|||
Before:
|
||||
Save g:ale_haskell_ghc_options
|
||||
|
||||
unlet! g:ale_haskell_ghc_options
|
||||
unlet! b:ale_haskell_ghc_options
|
||||
|
||||
runtime ale_linters/haskell/ghc.vim
|
||||
call ale#assert#SetUpLinterTest('haskell', 'ghc')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:ale_haskell_ghc_options
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The options should be used in the command):
|
||||
AssertEqual
|
||||
\ 'ghc -fno-code -v0 %t',
|
||||
\ ale_linters#haskell#ghc#GetCommand(bufnr(''))
|
||||
AssertLinter 'ghc', 'ghc -fno-code -v0 %t'
|
||||
|
||||
let b:ale_haskell_ghc_options = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ 'ghc foobar %t',
|
||||
\ ale_linters#haskell#ghc#GetCommand(bufnr(''))
|
||||
AssertLinter 'ghc', 'ghc foobar %t'
|
||||
|
|
|
@ -1,37 +1,16 @@
|
|||
Before:
|
||||
Save g:ale_haskell_hdevtools_executable
|
||||
Save g:ale_haskell_hdevtools_options
|
||||
|
||||
unlet! g:ale_haskell_hdevtools_executable
|
||||
unlet! b:ale_haskell_hdevtools_executable
|
||||
unlet! g:ale_haskell_hdevtools_options
|
||||
unlet! b:ale_haskell_hdevtools_options
|
||||
|
||||
runtime ale_linters/haskell/hdevtools.vim
|
||||
call ale#assert#SetUpLinterTest('haskell', 'hdevtools')
|
||||
|
||||
let b:command_tail = ' check -g -Wall -p %s %t'
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_haskell_hdevtools_executable
|
||||
unlet! b:ale_haskell_hdevtools_options
|
||||
call ale#linter#Reset()
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'hdevtools', ale_linters#haskell#hdevtools#GetExecutable(bufnr(''))
|
||||
AssertLinter 'hdevtools', ale#Escape('hdevtools') . b:command_tail
|
||||
|
||||
let b:ale_haskell_hdevtools_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#haskell#hdevtools#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('hdevtools') . b:command_tail,
|
||||
\ ale_linters#haskell#hdevtools#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_haskell_hdevtools_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . b:command_tail,
|
||||
\ ale_linters#haskell#hdevtools#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
|
||||
|
|
|
@ -1,71 +1,51 @@
|
|||
Before:
|
||||
Save g:ale_html_htmlhint_options
|
||||
Save g:ale_html_htmlhint_executable
|
||||
Save g:ale_html_htmlhint_use_global
|
||||
|
||||
unlet! g:ale_html_htmlhint_options
|
||||
unlet! g:ale_html_htmlhint_executable
|
||||
unlet! g:ale_html_htmlhint_use_global
|
||||
|
||||
runtime ale_linters/html/htmlhint.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('html', 'htmlhint')
|
||||
call ale#test#SetFilename('htmlhint_paths/test.html')
|
||||
|
||||
let g:node_executable = ale#path#Simplify(
|
||||
\ g:dir
|
||||
\ . '/htmlhint_paths/node_modules/.bin/htmlhint'
|
||||
\ g:dir . '/htmlhint_paths/node_modules/.bin/htmlhint'
|
||||
\)
|
||||
let g:config_path = ale#path#Simplify(
|
||||
\ g:dir
|
||||
\ . '/htmlhint_paths/with_config/.htmlhintrc'
|
||||
\ g:dir . '/htmlhint_paths/with_config/.htmlhintrc'
|
||||
\)
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! g:node_executable
|
||||
unlet! g:config_path
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual
|
||||
\ ale#Escape(g:node_executable) . ' --format=unix %t',
|
||||
\ ale_linters#html#htmlhint#GetCommand(bufnr(''))
|
||||
AssertLinter g:node_executable,
|
||||
\ ale#Escape(g:node_executable) . ' --format=unix %t'
|
||||
|
||||
Execute(The global executable should be uesd if the option is set):
|
||||
let g:ale_html_htmlhint_executable = 'foo'
|
||||
let g:ale_html_htmlhint_use_global = 1
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foo') . ' --format=unix %t',
|
||||
\ ale_linters#html#htmlhint#GetCommand(bufnr(''))
|
||||
AssertLinter 'foo', ale#Escape('foo') . ' --format=unix %t',
|
||||
|
||||
" This is so old configurations which might include this still work.
|
||||
Execute(--format=unix should be removed from the options if added):
|
||||
let g:ale_html_htmlhint_options = '--format=unix'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape(g:node_executable) . ' --format=unix %t',
|
||||
\ ale_linters#html#htmlhint#GetCommand(bufnr(''))
|
||||
AssertLinter g:node_executable,
|
||||
\ ale#Escape(g:node_executable) . ' --format=unix %t'
|
||||
|
||||
Execute(The configuration file should be automatically detected):
|
||||
call ale#test#SetFilename('htmlhint_paths/with_config/test.html')
|
||||
|
||||
AssertEqual
|
||||
AssertLinter g:node_executable,
|
||||
\ ale#Escape(g:node_executable)
|
||||
\ . ' --config ' . ale#Escape(g:config_path)
|
||||
\ . ' --format=unix %t',
|
||||
\ ale_linters#html#htmlhint#GetCommand(bufnr(''))
|
||||
\ . ' --format=unix %t'
|
||||
|
||||
" This is so old configurations which might include the config will work.
|
||||
Execute(The configuration file should be configurable through the options variable):
|
||||
call ale#test#SetFilename('htmlhint_paths/with_config/test.html')
|
||||
let g:ale_html_htmlhint_options = '--config=/foo/bar/.htmlhintrc'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter g:node_executable,
|
||||
\ ale#Escape(g:node_executable)
|
||||
\ . ' --config=/foo/bar/.htmlhintrc'
|
||||
\ . ' --format=unix %t',
|
||||
\ ale_linters#html#htmlhint#GetCommand(bufnr(''))
|
||||
\ . ' --format=unix %t'
|
||||
|
|
|
@ -1,42 +1,21 @@
|
|||
Before:
|
||||
Save g:ale_idris_idris_executable
|
||||
Save g:ale_idris_idris_options
|
||||
|
||||
unlet! g:ale_idris_idris_executable
|
||||
unlet! b:ale_idris_idris_executable
|
||||
unlet! g:ale_idris_idris_options
|
||||
unlet! b:ale_idris_idris_options
|
||||
|
||||
runtime ale_linters/idris/idris.vim
|
||||
call ale#assert#SetUpLinterTest('idris', 'idris')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_idris_idris_executable
|
||||
unlet! b:ale_idris_idris_options
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'idris', ale_linters#idris#idris#GetExecutable(bufnr(''))
|
||||
|
||||
let b:ale_idris_idris_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#idris#idris#GetExecutable(bufnr(''))
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('idris') . ' --total --warnpartial --warnreach --warnipkg --check %s',
|
||||
\ ale_linters#idris#idris#GetCommand(bufnr(''))
|
||||
AssertLinter 'idris',
|
||||
\ ale#Escape('idris') . ' --total --warnpartial --warnreach --warnipkg --check %s'
|
||||
|
||||
let b:ale_idris_idris_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' --total --warnpartial --warnreach --warnipkg --check %s',
|
||||
\ ale_linters#idris#idris#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' --total --warnpartial --warnreach --warnipkg --check %s'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_idris_idris_options = '--something'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('idris') . ' --something --check %s',
|
||||
\ ale_linters#idris#idris#GetCommand(bufnr(''))
|
||||
AssertLinter 'idris', ale#Escape('idris') . ' --something --check %s'
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
Before:
|
||||
Save g:ale_verilog_iverilog_options
|
||||
|
||||
unlet! g:ale_verilog_iverilog_options
|
||||
|
||||
runtime ale_linters/verilog/iverilog.vim
|
||||
call ale#assert#SetUpLinterTest('verilog', 'iverilog')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default iverilog command should be correct):
|
||||
AssertEqual
|
||||
\ 'iverilog -t null -Wall %t',
|
||||
\ ale_linters#verilog#iverilog#GetCommand(bufnr(''))
|
||||
AssertLinter 'iverilog', 'iverilog -t null -Wall %t'
|
||||
|
||||
Execute(iverilog options should be configurable):
|
||||
" Additional args for the linter
|
||||
let g:ale_verilog_iverilog_options = '-y.'
|
||||
|
||||
AssertEqual
|
||||
\ 'iverilog -t null -Wall -y. %t',
|
||||
\ ale_linters#verilog#iverilog#GetCommand(bufnr(''))
|
||||
AssertLinter 'iverilog', 'iverilog -t null -Wall -y. %t'
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
Before:
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
Save g:ale_java_javac_executable
|
||||
Save g:ale_java_javac_options
|
||||
Save g:ale_java_javac_classpath
|
||||
|
||||
unlet! g:ale_java_javac_executable
|
||||
unlet! g:ale_java_javac_options
|
||||
unlet! g:ale_java_javac_classpath
|
||||
call ale#assert#SetUpLinterTest('java', 'javac')
|
||||
call ale#test#SetFilename('dummy.java')
|
||||
|
||||
let g:cp_sep = has('unix') ? ':' : ';'
|
||||
let g:prefix = 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
|
||||
function! GetCommand(previous_output) abort
|
||||
let l:command = ale_linters#java#javac#GetCommand(
|
||||
|
@ -25,69 +20,58 @@ Before:
|
|||
return join(l:split_command)
|
||||
endfunction
|
||||
|
||||
runtime ale_linters/java/javac.vim
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
call ale#test#SetFilename('dummy.java')
|
||||
|
||||
let g:prefix = 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ale#Escape('javac') . ' -Xlint'
|
||||
|
||||
After:
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Restore
|
||||
|
||||
unlet! g:cp_sep
|
||||
unlet! g:prefix
|
||||
|
||||
delfunction GetCommand
|
||||
|
||||
call ale#linter#Reset()
|
||||
" We need to clean up the buffer to remove the temporary directories created
|
||||
" for the command.
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The javac callback should return the correct default value):
|
||||
AssertEqual g:prefix . ' -d TEMP %t', GetCommand([])
|
||||
AssertLinter 'javac', g:prefix . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should use g:ale_java_javac_classpath correctly):
|
||||
let g:ale_java_javac_classpath = 'foo.jar'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -cp ' . ale#Escape('foo.jar')
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_java_javac_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#java#javac#GetExecutable(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'foobar',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . ale#Escape('foobar') . ' -Xlint'
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should include discovered classpaths):
|
||||
AssertEqual
|
||||
WithChainResults [
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\]
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -cp '
|
||||
\ . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\ ])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should combine discovered classpaths and manual ones):
|
||||
let g:ale_java_javac_classpath = 'configured.jar'
|
||||
|
||||
AssertEqual
|
||||
WithChainResults [
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\]
|
||||
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -cp '
|
||||
\ . ale#Escape(join(
|
||||
|
@ -98,17 +82,11 @@ Execute(The javac callback should combine discovered classpaths and manual ones)
|
|||
\ ],
|
||||
\ g:cp_sep
|
||||
\ ))
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\ ])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
let g:ale_java_javac_classpath = 'configured.jar' . g:cp_sep . 'configured2.jar'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix
|
||||
\ . ' -cp '
|
||||
\ . ale#Escape(join(
|
||||
|
@ -120,55 +98,46 @@ Execute(The javac callback should combine discovered classpaths and manual ones)
|
|||
\ ],
|
||||
\ g:cp_sep
|
||||
\ ))
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\ ])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should detect source directories):
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
noautocmd e! java_paths/src/main/java/com/something/dummy
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'javac',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
||||
\ )
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should combine detected source directories and classpaths):
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
call ale#test#SetFilename('java_paths/src/main/java/com/something/dummy.java')
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
WithChainResults [
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\]
|
||||
AssertLinter 'javac',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -cp ' . ale#Escape(join(['/foo/bar.jar', '/xyz/abc.jar'], g:cp_sep))
|
||||
\ . ' -sourcepath ' . ale#Escape(
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/')
|
||||
\ )
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([
|
||||
\ '[DEBUG] Ignore this.',
|
||||
\ '[INFO] Something we should ignore.',
|
||||
\ '/foo/bar.jar',
|
||||
\ '/xyz/abc.jar',
|
||||
\ ])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should use g:ale_java_javac_options correctly):
|
||||
let g:ale_java_javac_options = '--anything --else'
|
||||
|
||||
let b:command = ale_linters#java#javac#GetCommand(bufnr(''), [])
|
||||
|
||||
AssertEqual
|
||||
\ g:prefix
|
||||
\ . ' -d TEMP --anything --else %t',
|
||||
\ GetCommand([])
|
||||
AssertLinter 'javac',
|
||||
\ g:prefix . ' -d ' . ale#Escape('TEMP_DIR') . ' --anything --else %t'
|
||||
|
||||
Execute(The javac callback should include src/test/java for test paths):
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
|
@ -177,25 +146,23 @@ Execute(The javac callback should include src/test/java for test paths):
|
|||
noautocmd e! java_paths/src/test/java/com/something/dummy
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'javac',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths/src/test/java/'),
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
||||
Execute(The javac callback should include src/main/jaxb when available):
|
||||
call ale#engine#Cleanup(bufnr(''))
|
||||
noautocmd e! java_paths_with_jaxb/src/main/java/com/something/dummy
|
||||
call ale#engine#InitBufferInfo(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'javac',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && ' . ale#Escape('javac') . ' -Xlint'
|
||||
\ . ' -sourcepath ' . ale#Escape(join([
|
||||
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/java/'),
|
||||
\ ale#path#Simplify(g:dir . '/java_paths_with_jaxb/src/main/jaxb/'),
|
||||
\ ], g:cp_sep))
|
||||
\ . ' -d TEMP %t',
|
||||
\ GetCommand([])
|
||||
\ . ' -d ' . ale#Escape('TEMP_DIR') . ' %t'
|
||||
|
|
|
@ -1,25 +1,15 @@
|
|||
Before:
|
||||
runtime ale_linters/javascript/jscs.vim
|
||||
call ale#assert#SetUpLinterTest('javascript', 'jscs')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
let g:ale_javascript_jscs_executable = 'jscs'
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Should return the correct default values):
|
||||
AssertEqual
|
||||
\ 'jscs',
|
||||
\ ale_linters#javascript#jscs#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('jscs') . ' --reporter inline --no-colors -',
|
||||
\ ale_linters#javascript#jscs#GetCommand(bufnr(''))
|
||||
|
||||
AssertLinter 'jscs',
|
||||
\ ale#Escape('jscs') . ' --reporter inline --no-colors -'
|
||||
|
||||
Execute(Should allow using a custom executable):
|
||||
let g:ale_javascript_jscs_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ 'foobar',
|
||||
\ ale_linters#javascript#jscs#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' --reporter inline --no-colors -',
|
||||
\ ale_linters#javascript#jscs#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar',
|
||||
\ ale#Escape('foobar') . ' --reporter inline --no-colors -'
|
||||
|
|
|
@ -1,31 +1,10 @@
|
|||
Before:
|
||||
Save g:ale_less_stylelint_executable
|
||||
Save g:ale_less_stylelint_use_global
|
||||
Save g:ale_less_stylelint_options
|
||||
|
||||
call ale#assert#SetUpLinterTest('less', 'stylelint')
|
||||
unlet! b:executable
|
||||
|
||||
unlet! g:ale_less_stylelint_executable
|
||||
unlet! g:ale_less_stylelint_use_global
|
||||
unlet! g:ale_less_stylelint_options
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#test#SetFilename('testfile.less')
|
||||
|
||||
runtime ale_linters/less/stylelint.vim
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:executable
|
||||
unlet! b:ale_less_stylelint_executable
|
||||
unlet! b:ale_less_stylelint_use_global
|
||||
unlet! b:ale_less_stylelint_options
|
||||
|
||||
call ale#test#SetFilename('test.txt')
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(node_modules directories should be discovered):
|
||||
call ale#test#SetFilename('stylelint_paths/nested/testfile.less')
|
||||
|
@ -35,10 +14,7 @@ Execute(node_modules directories should be discovered):
|
|||
\ . '/stylelint_paths/node_modules/.bin/stylelint'
|
||||
\)
|
||||
|
||||
AssertEqual b:executable, ale_linters#less#stylelint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape(b:executable) . ' --stdin-filename %s',
|
||||
\ ale_linters#less#stylelint#GetCommand(bufnr(''))
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin-filename %s'
|
||||
|
||||
Execute(The global override should work):
|
||||
let b:ale_less_stylelint_executable = 'foobar'
|
||||
|
@ -46,15 +22,10 @@ Execute(The global override should work):
|
|||
|
||||
call ale#test#SetFilename('stylelint_paths/nested/testfile.less')
|
||||
|
||||
AssertEqual 'foobar', ale_linters#less#stylelint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' --stdin-filename %s',
|
||||
\ ale_linters#less#stylelint#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin-filename %s'
|
||||
|
||||
Execute(Extra options should be configurable):
|
||||
let b:ale_less_stylelint_options = '--whatever'
|
||||
|
||||
AssertEqual 'stylelint', ale_linters#less#stylelint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('stylelint') . ' --whatever --stdin-filename %s',
|
||||
\ ale_linters#less#stylelint#GetCommand(bufnr(''))
|
||||
AssertLinter 'stylelint',
|
||||
\ ale#Escape('stylelint') . ' --whatever --stdin-filename %s'
|
||||
|
|
|
@ -1,31 +1,13 @@
|
|||
Before:
|
||||
Save g:ale_less_lessc_executable
|
||||
Save g:ale_less_lessc_use_global
|
||||
Save g:ale_less_lessc_options
|
||||
|
||||
unlet! b:executable
|
||||
|
||||
unlet! g:ale_less_lessc_executable
|
||||
unlet! g:ale_less_lessc_use_global
|
||||
unlet! g:ale_less_lessc_options
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('less', 'lessc')
|
||||
call ale#test#SetFilename('testfile.less')
|
||||
|
||||
runtime ale_linters/less/lessc.vim
|
||||
unlet! b:executable
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:executable
|
||||
unlet! b:ale_less_lessc_executable
|
||||
unlet! b:ale_less_lessc_use_global
|
||||
unlet! b:ale_less_lessc_options
|
||||
|
||||
call ale#test#SetFilename('test.txt')
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(node_modules directories should be discovered):
|
||||
call ale#test#SetFilename('lessc_paths/nested/testfile.less')
|
||||
|
@ -35,17 +17,11 @@ Execute(node_modules directories should be discovered):
|
|||
\ . '/lessc_paths/node_modules/.bin/lessc'
|
||||
\)
|
||||
|
||||
AssertEqual
|
||||
\ b:executable,
|
||||
\ ale_linters#less#lessc#GetExecutable(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape(b:executable)
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
|
||||
\ . ' -',
|
||||
\ ale_linters#less#lessc#GetCommand(bufnr(''))
|
||||
AssertLinter b:executable, ale#Escape(b:executable)
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(The global override should work):
|
||||
let b:ale_less_lessc_executable = 'foobar'
|
||||
|
@ -53,30 +29,18 @@ Execute(The global override should work):
|
|||
|
||||
call ale#test#SetFilename('lessc_paths/nested/testfile.less')
|
||||
|
||||
AssertEqual
|
||||
\ 'foobar',
|
||||
\ ale_linters#less#lessc#GetExecutable(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar')
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
|
||||
\ . ' -',
|
||||
\ ale_linters#less#lessc#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/lessc_paths/nested'))
|
||||
\ . ' -'
|
||||
|
||||
Execute(Extra options should be configurable):
|
||||
let b:ale_less_lessc_options = '--whatever'
|
||||
|
||||
AssertEqual
|
||||
\ 'lessc',
|
||||
\ ale_linters#less#lessc#GetExecutable(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('lessc')
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir))
|
||||
\ . ' --whatever'
|
||||
\ . ' -',
|
||||
\ ale_linters#less#lessc#GetCommand(bufnr(''))
|
||||
AssertLinter 'lessc', ale#Escape('lessc')
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path='
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir))
|
||||
\ . ' --whatever'
|
||||
\ . ' -'
|
||||
|
|
|
@ -1,48 +1,36 @@
|
|||
Before:
|
||||
Save g:ale_r_lintr_options
|
||||
|
||||
unlet! g:ale_r_lintr_options
|
||||
unlet! b:ale_r_lintr_options
|
||||
|
||||
runtime ale_linters/r/lintr.vim
|
||||
call ale#assert#SetUpLinterTest('r', 'lintr')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_r_lintr_options
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default lintr command should be correct):
|
||||
AssertEqual
|
||||
AssertLinter 'Rscript',
|
||||
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
||||
\ . 'Rscript --vanilla -e '
|
||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||
\ . 'with_defaults())')
|
||||
\ . ' %t',
|
||||
\ ale_linters#r#lintr#GetCommand(bufnr(''))
|
||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||
\ . 'with_defaults())')
|
||||
\ . ' %t'
|
||||
|
||||
Execute(The lintr options should be configurable):
|
||||
let b:ale_r_lintr_options = 'with_defaults(object_usage_linter = NULL)'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'Rscript',
|
||||
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
||||
\ . 'Rscript --vanilla -e '
|
||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||
\ . 'with_defaults(object_usage_linter = NULL))')
|
||||
\ . ' %t',
|
||||
\ ale_linters#r#lintr#GetCommand(bufnr(''))
|
||||
\ . 'lint(cache = FALSE, commandArgs(TRUE), '
|
||||
\ . 'with_defaults(object_usage_linter = NULL))')
|
||||
\ . ' %t'
|
||||
|
||||
Execute(If the lint_package flag is set, lintr::lint_package should be called):
|
||||
let b:ale_r_lintr_lint_package = 1
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'Rscript',
|
||||
\ 'cd ' . ale#Escape(getcwd()) . ' && '
|
||||
\ . 'Rscript --vanilla -e '
|
||||
\ . ale#Escape('suppressPackageStartupMessages(library(lintr));'
|
||||
\ . 'lint_package(cache = FALSE, '
|
||||
\ . 'linters = with_defaults())')
|
||||
\ . ' %t',
|
||||
\ ale_linters#r#lintr#GetCommand(bufnr(''))
|
||||
\ . 'lint_package(cache = FALSE, '
|
||||
\ . 'linters = with_defaults())')
|
||||
\ . ' %t'
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
Before:
|
||||
Save g:ale_llvm_llc_executable
|
||||
|
||||
unlet! g:ale_llvm_llc_executable
|
||||
unlet! b:ale_llvm_llc_executable
|
||||
|
||||
runtime ale_linters/llvm/llc.vim
|
||||
call ale#assert#SetUpLinterTest('llvm', 'llc')
|
||||
|
||||
function! AssertHasPrefix(str, prefix) abort
|
||||
let msg = printf("'%s' is expected to be prefixed with '%s'", a:str, a:prefix)
|
||||
|
@ -12,28 +7,15 @@ Before:
|
|||
endfunction
|
||||
|
||||
After:
|
||||
unlet! g:ale_llvm_llc_executable
|
||||
unlet! b:ale_llvm_llc_executable
|
||||
delfunction AssertHasPrefix
|
||||
Restore
|
||||
|
||||
Execute(llc command is customizable):
|
||||
let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
|
||||
call AssertHasPrefix(cmd, ale#Escape('llc'))
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The llc command should be customizable):
|
||||
AssertLinter 'llc',
|
||||
\ ale#Escape('llc') . ' -filetype=null -o=' . g:ale#util#nul_file
|
||||
|
||||
let g:ale_llvm_llc_executable = 'llc-5.0'
|
||||
let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
|
||||
call AssertHasPrefix(cmd, ale#Escape('llc-5.0'))
|
||||
|
||||
let b:ale_llvm_llc_executable = 'llc-4.0'
|
||||
let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
|
||||
call AssertHasPrefix(cmd, ale#Escape('llc-4.0'))
|
||||
|
||||
Execute(GetCommand() escapes the returned path):
|
||||
let b:ale_llvm_llc_executable = '/path/space contained/llc'
|
||||
let cmd = ale_linters#llvm#llc#GetCommand(bufnr(''))
|
||||
call AssertHasPrefix(cmd, ale#Escape('/path/space contained/llc'))
|
||||
|
||||
Execute(GetExecutable() does not escape the returned path):
|
||||
let b:ale_llvm_llc_executable = '/path/space contained/llc'
|
||||
AssertEqual ale_linters#llvm#llc#GetExecutable(bufnr('')), '/path/space contained/llc'
|
||||
AssertLinter 'llc-5.0',
|
||||
\ ale#Escape('llc-5.0') . ' -filetype=null -o=' . g:ale#util#nul_file
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
Before:
|
||||
runtime ale_linters/lua/luac.vim
|
||||
call ale#assert#SetUpLinterTest('lua', 'luac')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual ale#Escape('luac') . ' -p -',
|
||||
\ join(split(ale_linters#lua#luac#GetCommand(1)))
|
||||
AssertLinter 'luac', ale#Escape('luac') . ' -p - '
|
||||
|
||||
Execute(The luac executable should be configurable):
|
||||
let g:ale_lua_luac_executable = 'luac.sh'
|
||||
|
||||
AssertEqual 'luac.sh', ale_linters#lua#luac#GetExecutable(1)
|
||||
AssertEqual ale#Escape('luac.sh') . ' -p -',
|
||||
\ join(split(ale_linters#lua#luac#GetCommand(1)))
|
||||
AssertLinter 'luac.sh', ale#Escape('luac.sh') . ' -p - '
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
Before:
|
||||
runtime ale_linters/lua/luacheck.vim
|
||||
call ale#assert#SetUpLinterTest('lua', 'luacheck')
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
let g:ale_lua_luacheck_options = ''
|
||||
let g:ale_lua_luacheck_executable = 'luacheck'
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The lua luacheck command callback should return the correct default string):
|
||||
AssertEqual ale#Escape('luacheck') . ' --formatter plain --codes --filename %s -',
|
||||
\ join(split(ale_linters#lua#luacheck#GetCommand(1)))
|
||||
AssertLinter 'luacheck',
|
||||
\ ale#Escape('luacheck') . ' --formatter plain --codes --filename %s -'
|
||||
|
||||
Execute(The lua luacheck command callback should let you set options):
|
||||
let g:ale_lua_luacheck_options = '--config filename'
|
||||
|
||||
AssertEqual ale#Escape('luacheck') . ' --config filename --formatter plain --codes --filename %s -',
|
||||
\ join(split(ale_linters#lua#luacheck#GetCommand(1)))
|
||||
AssertLinter 'luacheck',
|
||||
\ ale#Escape('luacheck')
|
||||
\ . ' --config filename'
|
||||
\ . ' --formatter plain --codes --filename %s -'
|
||||
|
||||
Execute(The luacheck executable should be configurable):
|
||||
let g:ale_lua_luacheck_executable = 'luacheck.sh'
|
||||
|
||||
AssertEqual 'luacheck.sh', ale_linters#lua#luacheck#GetExecutable(1)
|
||||
AssertEqual ale#Escape('luacheck.sh') . ' --formatter plain --codes --filename %s -',
|
||||
\ join(split(ale_linters#lua#luacheck#GetCommand(1)))
|
||||
AssertLinter 'luacheck.sh',
|
||||
\ ale#Escape('luacheck.sh') . ' --formatter plain --codes --filename %s -'
|
||||
|
|
|
@ -1,35 +1,19 @@
|
|||
Before:
|
||||
Save g:ale_markdown_mdl_executable
|
||||
Save g:ale_markdown_mdl_options
|
||||
|
||||
unlet! g:ale_markdown_mdl_executable
|
||||
unlet! g:ale_markdown_mdl_options
|
||||
|
||||
runtime ale_linters/markdown/mdl.vim
|
||||
call ale#assert#SetUpLinterTest('markdown', 'mdl')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual ale_linters#markdown#mdl#GetExecutable(bufnr('')), 'mdl'
|
||||
AssertEqual
|
||||
\ ale_linters#markdown#mdl#GetCommand(bufnr('')),
|
||||
\ ale#Escape('mdl')
|
||||
AssertLinter 'mdl', ale#Escape('mdl')
|
||||
|
||||
Execute(The executable and options should be configurable):
|
||||
let g:ale_markdown_mdl_executable = 'foo bar'
|
||||
let g:ale_markdown_mdl_options = '--wat'
|
||||
|
||||
AssertEqual ale_linters#markdown#mdl#GetExecutable(bufnr('')), 'foo bar'
|
||||
AssertEqual
|
||||
\ ale_linters#markdown#mdl#GetCommand(bufnr('')),
|
||||
\ ale#Escape('foo bar') . ' --wat'
|
||||
AssertLinter 'foo bar', ale#Escape('foo bar') . ' --wat'
|
||||
|
||||
Execute(Setting bundle appends 'exec mdl'):
|
||||
let g:ale_markdown_mdl_executable = 'path to/bundle'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('path to/bundle') . ' exec mdl',
|
||||
\ ale_linters#markdown#mdl#GetCommand(bufnr(''))
|
||||
AssertLinter 'path to/bundle', ale#Escape('path to/bundle') . ' exec mdl'
|
||||
|
|
|
@ -1,42 +1,25 @@
|
|||
Before:
|
||||
Save g:ale_mercury_mmc_executable
|
||||
Save g:ale_mercury_mmc_options
|
||||
|
||||
unlet! g:ale_mercury_mmc_executable
|
||||
unlet! b:ale_mercury_mmc_executable
|
||||
unlet! g:ale_mercury_mmc_options
|
||||
unlet! b:ale_mercury_mmc_options
|
||||
|
||||
runtime ale_linters/mercury/mmc.vim
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('mercury', 'mmc')
|
||||
call ale#test#SetFilename('dummy')
|
||||
|
||||
After:
|
||||
unlet! b:ale_mercury_mmc_executable
|
||||
unlet! b:ale_mercury_mmc_options
|
||||
|
||||
Restore
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertEqual
|
||||
AssertLinter 'mmc',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mmc --errorcheck-only --make --output-compile-error-lines 100 dummy',
|
||||
\
|
||||
\ ale_linters#mercury#mmc#GetCommand(bufnr(''))
|
||||
\ . 'mmc --errorcheck-only --make --output-compile-error-lines 100 dummy'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_mercury_mmc_executable = 'foo'
|
||||
AssertEqual
|
||||
|
||||
AssertLinter 'foo',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'foo --errorcheck-only --make --output-compile-error-lines 100 dummy',
|
||||
\
|
||||
\ ale_linters#mercury#mmc#GetCommand(bufnr(''))
|
||||
\ . 'foo --errorcheck-only --make --output-compile-error-lines 100 dummy'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_mercury_mmc_options = '--bar'
|
||||
AssertEqual
|
||||
|
||||
AssertLinter 'mmc',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . 'mmc --errorcheck-only --bar dummy',
|
||||
\
|
||||
\ ale_linters#mercury#mmc#GetCommand(bufnr(''))
|
||||
\ . 'mmc --errorcheck-only --bar dummy'
|
||||
|
|
|
@ -1,106 +1,71 @@
|
|||
Before:
|
||||
Save g:ale_python_mypy_executable
|
||||
Save g:ale_python_mypy_options
|
||||
Save g:ale_python_mypy_use_global
|
||||
|
||||
unlet! g:ale_python_mypy_executable
|
||||
unlet! g:ale_python_mypy_options
|
||||
unlet! g:ale_python_mypy_use_global
|
||||
call ale#assert#SetUpLinterTest('python', 'mypy')
|
||||
call ale#test#SetFilename('test.py')
|
||||
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
runtime ale_linters/python/mypy.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#test#SetFilename('test.py')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:bin_dir
|
||||
unlet! b:executable
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The mypy callbacks should return the correct default values):
|
||||
AssertEqual
|
||||
\ 'mypy',
|
||||
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter 'mypy',
|
||||
\ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
|
||||
\ . ' --show-column-numbers '
|
||||
\ . '--shadow-file %s %t %s',
|
||||
\ ale_linters#python#mypy#GetCommand(bufnr(''))
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(The mypy executable should be configurable, and escaped properly):
|
||||
let g:ale_python_mypy_executable = 'executable with spaces'
|
||||
|
||||
AssertEqual
|
||||
\ 'executable with spaces',
|
||||
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter 'executable with spaces',
|
||||
\ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('executable with spaces')
|
||||
\ . ' --show-column-numbers '
|
||||
\ . '--shadow-file %s %t %s',
|
||||
\ ale_linters#python#mypy#GetCommand(bufnr(''))
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(The mypy command callback should let you set options):
|
||||
let g:ale_python_mypy_options = '--some-option'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'mypy',
|
||||
\ 'cd ' . ale#Escape(g:dir) . ' && ' . ale#Escape('mypy')
|
||||
\ . ' --show-column-numbers --some-option '
|
||||
\ . '--shadow-file %s %t %s',
|
||||
\ ale_linters#python#mypy#GetCommand(bufnr(''))
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(The mypy command should switch directories to the detected project root):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/no_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertEqual
|
||||
\ 'mypy',
|
||||
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter 'mypy',
|
||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/no_virtualenv/subdir'))
|
||||
\ . ' && ' . ale#Escape('mypy')
|
||||
\ . ' --show-column-numbers '
|
||||
\ . '--shadow-file %s %t %s',
|
||||
\ ale_linters#python#mypy#GetCommand(bufnr(''))
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(The mypy callbacks should detect virtualenv directories and switch to the project root):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
let b:executable = ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/mypy')
|
||||
|
||||
AssertEqual
|
||||
\ b:executable,
|
||||
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter b:executable,
|
||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
|
||||
\ . ' && ' . ale#Escape(b:executable)
|
||||
\ . ' --show-column-numbers '
|
||||
\ . '--shadow-file %s %t %s',
|
||||
\ ale_linters#python#mypy#GetCommand(bufnr(''))
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(You should able able to use the global mypy instead):
|
||||
silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py')
|
||||
let g:ale_python_mypy_use_global = 1
|
||||
|
||||
AssertEqual
|
||||
\ 'mypy',
|
||||
\ ale_linters#python#mypy#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
AssertLinter 'mypy',
|
||||
\ 'cd ' . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/subdir'))
|
||||
\ . ' && ' . ale#Escape('mypy')
|
||||
\ . ' --show-column-numbers '
|
||||
\ . '--shadow-file %s %t %s',
|
||||
\ ale_linters#python#mypy#GetCommand(bufnr(''))
|
||||
\ . '--shadow-file %s %t %s'
|
||||
|
||||
Execute(Setting executable to 'pipenv' appends 'run mypy'):
|
||||
let g:ale_python_mypy_executable = 'path/to/pipenv'
|
||||
|
||||
AssertEqual
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#path#BufferCdString(bufnr(''))
|
||||
\ . ale#Escape('path/to/pipenv') . ' run mypy'
|
||||
\ . ' --show-column-numbers --shadow-file %s %t %s',
|
||||
\ ale_linters#python#mypy#GetCommand(bufnr(''))
|
||||
\ . ' --show-column-numbers --shadow-file %s %t %s'
|
||||
|
|
|
@ -1,42 +1,19 @@
|
|||
Before:
|
||||
Save g:ale_tcl_nagelfar_executable
|
||||
Save g:ale_tcl_nagelfar_options
|
||||
|
||||
unlet! g:ale_tcl_nagelfar_executable
|
||||
unlet! b:ale_tcl_nagelfar_executable
|
||||
unlet! g:ale_tcl_nagelfar_options
|
||||
unlet! b:ale_tcl_nagelfar_options
|
||||
|
||||
runtime ale_linters/tcl/nagelfar.vim
|
||||
call ale#assert#SetUpLinterTest('tcl', 'nagelfar')
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:ale_tcl_nagelfar_executable
|
||||
unlet! b:ale_tcl_nagelfar_options
|
||||
call ale#linter#Reset()
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'nagelfar.tcl', ale_linters#tcl#nagelfar#GetExecutable(bufnr(''))
|
||||
AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' %s'
|
||||
|
||||
let b:ale_tcl_nagelfar_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale_linters#tcl#nagelfar#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('nagelfar.tcl') . ' %s',
|
||||
\ ale_linters#tcl#nagelfar#GetCommand(bufnr(''))
|
||||
|
||||
let b:ale_tcl_nagelfar_executable = 'foobar'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' %s',
|
||||
\ ale_linters#tcl#nagelfar#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' %s'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let b:ale_tcl_nagelfar_options = '--something'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('nagelfar.tcl') . ' --something %s',
|
||||
\ ale_linters#tcl#nagelfar#GetCommand(bufnr(''))
|
||||
AssertLinter 'nagelfar.tcl', ale#Escape('nagelfar.tcl') . ' --something %s'
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
Before:
|
||||
Save g:ale_nasm_nasm_executable
|
||||
Save g:ale_nasm_nasm_options
|
||||
|
||||
unlet! g:ale_nasm_nasm_executable
|
||||
unlet! b:ale_nasm_nasm_executable
|
||||
unlet! g:ale_nasm_nasm_options
|
||||
unlet! b:ale_nasm_nasm_options
|
||||
|
||||
runtime ale_linters/nasm/nasm.vim
|
||||
call ale#assert#SetUpLinterTest('nasm', 'nasm')
|
||||
|
||||
let b:command_tail =
|
||||
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' %s'
|
||||
|
@ -15,38 +7,25 @@ Before:
|
|||
\ ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w+orphan-labels %s'
|
||||
|
||||
After:
|
||||
Restore
|
||||
unlet! b:command_tail
|
||||
unlet! b:command_tail_opt
|
||||
unlet! b:ale_nasm_nasm_executable
|
||||
unlet! b:ale_nasm_nasm_options
|
||||
call ale#linter#Reset()
|
||||
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
AssertEqual 'nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))
|
||||
|
||||
let b:ale_nasm_nasm_executable = '/opt/nasm/nasm'
|
||||
|
||||
AssertEqual '/opt/nasm/nasm', ale_linters#nasm#nasm#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(The executable should be used in the command):
|
||||
AssertEqual
|
||||
\ ale#Escape('nasm') . b:command_tail,
|
||||
\ ale_linters#nasm#nasm#GetCommand(bufnr(''))
|
||||
AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail,
|
||||
|
||||
let b:ale_nasm_nasm_executable = '~/nasm'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('~/nasm') . b:command_tail,
|
||||
\ ale_linters#nasm#nasm#GetCommand(bufnr(''))
|
||||
AssertLinter '~/nasm', ale#Escape('~/nasm') . b:command_tail
|
||||
|
||||
Execute(The options should be configurable):
|
||||
AssertEqual '', ale_linters#nasm#nasm#GetOptions(bufnr(''))
|
||||
let b:ale_nasm_nasm_options = '-w-macro-params'
|
||||
AssertEqual '-w-macro-params', ale_linters#nasm#nasm#GetOptions(bufnr(''))
|
||||
|
||||
AssertLinter 'nasm', ale#Escape('nasm')
|
||||
\ . ' -X gnu -I ' . ale#Escape(getcwd() . (has('win32') ? '\' : '/')) . ' -w-macro-params %s'
|
||||
|
||||
Execute(The options should be used in command):
|
||||
let b:ale_nasm_nasm_options = '-w+orphan-labels'
|
||||
AssertEqual
|
||||
\ ale#Escape('nasm') . b:command_tail_opt,
|
||||
\ ale_linters#nasm#nasm#GetCommand(bufnr(''))
|
||||
let b:ale_nasm_nasm_options = '-w+orphan-labels'
|
||||
|
||||
AssertLinter 'nasm', ale#Escape('nasm') . b:command_tail_opt
|
||||
|
|
|
@ -1,54 +1,40 @@
|
|||
Before:
|
||||
call ale#assert#SetUpLinterTest('ocaml', 'ols')
|
||||
|
||||
Save &filetype
|
||||
Save g:ale_ocaml_ols_executable
|
||||
Save g:ale_ocaml_ols_use_global
|
||||
|
||||
let &filetype = 'ocaml'
|
||||
unlet! g:ale_ocaml_ols_executable
|
||||
unlet! g:ale_ocaml_ols_use_global
|
||||
|
||||
runtime ale_linters/ocaml/ols.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The language string should be correct):
|
||||
AssertEqual 'ocaml', ale#handlers#ols#GetLanguage(bufnr(''))
|
||||
AssertLSPLanguage 'ocaml'
|
||||
|
||||
Execute(The default executable should be correct):
|
||||
AssertEqual 'ocaml-language-server', ale#handlers#ols#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('ocaml-language-server') . ' --stdio',
|
||||
\ ale#handlers#ols#GetCommand(bufnr(''))
|
||||
AssertLinter 'ocaml-language-server',
|
||||
\ ale#Escape('ocaml-language-server') . ' --stdio'
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
AssertEqual '', ale#handlers#ols#GetProjectRoot(bufnr(''))
|
||||
AssertLSPProject ''
|
||||
|
||||
call ale#test#SetFilename('ols_paths/file.ml')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/ols_paths'),
|
||||
\ ale#handlers#ols#GetProjectRoot(bufnr(''))
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/ols_paths')
|
||||
|
||||
Execute(The local executable should be used when available):
|
||||
call ale#test#SetFilename('ols_paths/file.ml')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/ols_paths/node_modules/.bin/ocaml-language-server'),
|
||||
\ ale#handlers#ols#GetExecutable(bufnr(''))
|
||||
AssertLinter ale#path#Simplify(g:dir . '/ols_paths/node_modules/.bin/ocaml-language-server'),
|
||||
\ ale#Escape(ale#path#Simplify(g:dir . '/ols_paths/node_modules/.bin/ocaml-language-server')) . ' --stdio'
|
||||
|
||||
Execute(The gloabl executable should always be used when use_global is set):
|
||||
let g:ale_ocaml_ols_use_global = 1
|
||||
call ale#test#SetFilename('ols_paths/file.ml')
|
||||
|
||||
AssertEqual 'ocaml-language-server', ale#handlers#ols#GetExecutable(bufnr(''))
|
||||
AssertLinter 'ocaml-language-server',
|
||||
\ ale#Escape('ocaml-language-server') . ' --stdio'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_ocaml_ols_executable = 'foobar'
|
||||
|
||||
AssertEqual 'foobar', ale#handlers#ols#GetExecutable(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio'
|
||||
|
|
|
@ -1,37 +1,14 @@
|
|||
Before:
|
||||
Save g:ale_perl_perl_executable
|
||||
Save g:ale_perl_perl_options
|
||||
|
||||
unlet! g:ale_perl_perl_executable
|
||||
unlet! g:ale_perl_perl_options
|
||||
|
||||
runtime ale_linters/perl/perl.vim
|
||||
call ale#assert#SetUpLinterTest('perl', 'perl')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_perl_perl_executable
|
||||
unlet! b:ale_perl_perl_options
|
||||
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default Perl command callback should be correct):
|
||||
AssertEqual
|
||||
\ 'perl',
|
||||
\ ale_linters#perl#perl#GetExecutable(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perl') . ' -c -Mwarnings -Ilib %t',
|
||||
\ ale_linters#perl#perl#GetCommand(bufnr(''))
|
||||
AssertLinter 'perl', ale#Escape('perl') . ' -c -Mwarnings -Ilib %t'
|
||||
|
||||
Execute(Overriding the executable and command should work):
|
||||
let b:ale_perl_perl_executable = 'foobar'
|
||||
let b:ale_perl_perl_options = '-w'
|
||||
|
||||
AssertEqual
|
||||
\ 'foobar',
|
||||
\ ale_linters#perl#perl#GetExecutable(bufnr(''))
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' -w %t',
|
||||
\ ale_linters#perl#perl#GetCommand(bufnr(''))
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' -w %t'
|
||||
|
|
|
@ -1,67 +1,36 @@
|
|||
Before:
|
||||
Save g:ale_perl_perlcritic_profile
|
||||
Save g:ale_perl_perlcritic_options
|
||||
Save g:ale_perl_perlcritic_executable
|
||||
Save g:ale_perl_perlcritic_showrules
|
||||
|
||||
unlet! g:ale_perl_perlcritic_options
|
||||
unlet! g:ale_perl_perlcritic_executable
|
||||
unlet! g:ale_perl_perlcritic_showrules
|
||||
call ale#assert#SetUpLinterTest('perl', 'perlcritic')
|
||||
call ale#test#SetFilename('test.pl')
|
||||
let g:ale_perl_perlcritic_profile = ''
|
||||
|
||||
runtime ale_linters/perl/perlcritic.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#test#SetFilename('test.pl')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
unlet! b:ale_perl_perlcritic_profile
|
||||
unlet! b:ale_perl_perlcritic_options
|
||||
unlet! b:ale_perl_perlcritic_executable
|
||||
unlet! b:ale_perl_perlcritic_showrules
|
||||
unlet! b:readme_path
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The command should be correct with g:ale_perl_perlcritic_showrules off):
|
||||
let b:ale_perl_perlcritic_showrules = 0
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
||||
\ . ' --nocolor',
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
AssertLinter 'perlcritic', ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor'
|
||||
|
||||
Execute(The command should be correct with g:ale_perl_perlcritic_showrules on):
|
||||
let b:ale_perl_perlcritic_showrules = 1
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m [%p]\n')
|
||||
\ . ' --nocolor',
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
AssertLinter 'perlcritic', ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m [%p]\n') . ' --nocolor'
|
||||
|
||||
Execute(The command search for the profile file when set):
|
||||
let b:ale_perl_perlcritic_profile = 'README.md'
|
||||
|
||||
let b:readme_path = ale#path#Simplify(expand('%:p:h:h:h') . '/README.md')
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
||||
\ . ' --nocolor'
|
||||
\ . ' --profile ' . ale#Escape(b:readme_path),
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
AssertLinter 'perlcritic', ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor'
|
||||
\ . ' --profile ' . ale#Escape(b:readme_path)
|
||||
|
||||
Execute(Extra options should be set appropriately):
|
||||
let b:ale_perl_perlcritic_options = 'beep boop'
|
||||
|
||||
AssertEqual
|
||||
\ ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n')
|
||||
\ . ' --nocolor'
|
||||
\ . ' beep boop',
|
||||
\ ale_linters#perl#perlcritic#GetCommand(bufnr(''))
|
||||
AssertLinter 'perlcritic', ale#Escape('perlcritic')
|
||||
\ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor'
|
||||
\ . ' beep boop'
|
||||
|
|
|
@ -1,49 +1,29 @@
|
|||
Before:
|
||||
Save g:ale_php_langserver_executable
|
||||
Save g:ale_php_langserver_config_path
|
||||
Save g:ale_php_langserver_use_global
|
||||
|
||||
unlet! g:ale_php_langserver_executable
|
||||
unlet! g:ale_php_langserver_config_path
|
||||
unlet! g:ale_php_langserver_use_global
|
||||
|
||||
runtime ale_linters/php/langserver.vim
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||||
call ale#assert#SetUpLinterTest('php', 'langserver')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
if isdirectory(g:dir . '/.git')
|
||||
call delete(g:dir . '/.git', 'd')
|
||||
endif
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#linter#Reset()
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path should be correct):
|
||||
AssertEqual
|
||||
\ 'php-language-server.php',
|
||||
\ ale_linters#php#langserver#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ 'php ' . ale#Escape('php-language-server.php'),
|
||||
\ ale_linters#php#langserver#GetCommand(bufnr(''))
|
||||
AssertLinter 'php-language-server.php',
|
||||
\ 'php ' . ale#Escape('php-language-server.php')
|
||||
|
||||
Execute(Vendor executables should be detected):
|
||||
call ale#test#SetFilename('php-langserver-project/test.php')
|
||||
|
||||
AssertEqual
|
||||
AssertLinter
|
||||
\ ale#path#Simplify(g:dir . '/php-langserver-project/vendor/bin/php-language-server.php'),
|
||||
\ ale_linters#php#langserver#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ 'php ' . ale#Escape(ale#path#Simplify(
|
||||
\ g:dir
|
||||
\ . '/php-langserver-project/vendor/bin/php-language-server.php'
|
||||
\ )),
|
||||
\ ale_linters#php#langserver#GetCommand(bufnr(''))
|
||||
\ ))
|
||||
|
||||
Execute(The project path should be correct for .git directories):
|
||||
call ale#test#SetFilename('php-langserver-project/test.php')
|
||||
call mkdir(g:dir . '/.git')
|
||||
|
||||
AssertEqual g:dir, ale_linters#php#langserver#GetProjectRoot(bufnr(''))
|
||||
AssertLSPProject g:dir
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue