mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-24 13:01:28 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -38,3 +38,10 @@ Execute(Builds credo command with suggest mode when set to 0):
|
||||
AssertLinter 'mix',
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
|
||||
\ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||
|
||||
Execute(Builds credo command with a custom config file):
|
||||
let g:ale_elixir_credo_config_file = '/home/user/custom_credo.exs'
|
||||
|
||||
AssertLinter 'mix',
|
||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
|
||||
\ . 'mix help credo && mix credo suggest --config-file /home/user/custom_credo.exs --format=flycheck --read-from-stdin %s'
|
||||
|
||||
@@ -11,16 +11,16 @@ After:
|
||||
Execute(The default executable path should be correct):
|
||||
AssertLinter 'julia',
|
||||
\ ale#Escape('julia') .
|
||||
\' --startup-file=no --history-file=no -e ' .
|
||||
\ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);')
|
||||
\' --project=@. --startup-file=no --history-file=no -e ' .
|
||||
\ ale#Escape('using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_julia_executable = 'julia-new'
|
||||
|
||||
AssertLinter 'julia-new',
|
||||
\ ale#Escape('julia-new') .
|
||||
\' --startup-file=no --history-file=no -e ' .
|
||||
\ ale#Escape('using LanguageServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, false); server.runlinter = true; run(server);')
|
||||
\' --project=@. --startup-file=no --history-file=no -e ' .
|
||||
\ ale#Escape('using LanguageServer; using Pkg; import StaticLint; import SymbolServer; server = LanguageServer.LanguageServerInstance(isdefined(Base, :stdin) ? stdin : STDIN, isdefined(Base, :stdout) ? stdout : STDOUT, dirname(Pkg.Types.Context().env.project_file)); server.runlinter = true; run(server);')
|
||||
|
||||
Execute(The project root should be detected correctly):
|
||||
AssertLSPProject ''
|
||||
|
||||
@@ -16,5 +16,5 @@ Execute(The project root should be detected correctly):
|
||||
|
||||
Execute(Should accept configuration settings):
|
||||
AssertLSPConfig {}
|
||||
let b:ale_rust_analyzer_config = {'rust': {'clippy_preference': 'on'}}
|
||||
AssertLSPConfig {'rust': {'clippy_preference': 'on'}}
|
||||
let b:ale_rust_analyzer_config = {'diagnostics': {'disabled': ['unresolved-import']}}
|
||||
AssertLSPOptions {'diagnostics': {'disabled': ['unresolved-import']}}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('dhall', 'dhall')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertFixer
|
||||
\ { 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('dhall') . ' format --inplace %t'
|
||||
\ }
|
||||
24
test/fixers/test_dhall_format_fixer_callback.vader
Normal file
24
test/fixers/test_dhall_format_fixer_callback.vader
Normal file
@@ -0,0 +1,24 @@
|
||||
Before:
|
||||
Save g:ale_dhall_executable
|
||||
Save g:ale_dhall_options
|
||||
|
||||
" Use an invalid global executable, so we don’t match it.
|
||||
let g:ale_dhall_executable = 'odd-dhall'
|
||||
let g:ale_dhall_options = '--ascii'
|
||||
|
||||
call ale#assert#SetUpFixerTest('dhall-format', 'dhall-format')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The dhall-format callback should return the correct options):
|
||||
call ale#test#SetFilename('../dhall_files/testfile.dhall')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('odd-dhall')
|
||||
\ . ' --ascii'
|
||||
\ . ' format'
|
||||
\ . ' --inplace %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ }
|
||||
24
test/fixers/test_dhall_freeze_fixer_callback.vader
Normal file
24
test/fixers/test_dhall_freeze_fixer_callback.vader
Normal file
@@ -0,0 +1,24 @@
|
||||
Before:
|
||||
Save g:ale_dhall_executable
|
||||
Save g:ale_dhall_options
|
||||
|
||||
" Use an invalid global executable, so we don’t match it.
|
||||
let g:ale_dhall_executable = 'odd-dhall'
|
||||
let g:ale_dhall_options = '--ascii'
|
||||
let g:ale_dhall_freeze_options = '--all'
|
||||
|
||||
call ale#assert#SetUpFixerTest('dhall-freeze', 'dhall-freeze')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The dhall-freeze callback should return the correct options):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('odd-dhall')
|
||||
\ . ' --ascii'
|
||||
\ . ' freeze'
|
||||
\ . ' --all'
|
||||
\ . ' --inplace %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ }
|
||||
22
test/fixers/test_dhall_lint_fixer_callback.vader
Normal file
22
test/fixers/test_dhall_lint_fixer_callback.vader
Normal file
@@ -0,0 +1,22 @@
|
||||
Before:
|
||||
Save g:ale_dhall_executable
|
||||
Save g:ale_dhall_options
|
||||
|
||||
" Use an invalid global executable, so we don’t match it.
|
||||
let g:ale_dhall_executable = 'odd-dhall'
|
||||
let g:ale_dhall_options = '--ascii'
|
||||
|
||||
call ale#assert#SetUpFixerTest('dhall-lint', 'dhall-lint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The dhall-lint callback should return the correct options):
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('odd-dhall')
|
||||
\ . ' --ascii'
|
||||
\ . ' lint'
|
||||
\ . ' --inplace %t',
|
||||
\ 'read_temporary_file': 1,
|
||||
\ }
|
||||
@@ -20,9 +20,17 @@ Execute(The Dafny handler should parse output correctly):
|
||||
\ 'lnum': 678,
|
||||
\ 'text': 'This is the precondition that might not hold.',
|
||||
\ 'type': 'W'
|
||||
\ }
|
||||
\ },
|
||||
\ {
|
||||
\ 'bufnr': 0,
|
||||
\ 'col': 45,
|
||||
\ 'lnum': 123,
|
||||
\ 'text': "Verification of 'Impl$$_22_Proof.__default.PutKeepsMapsFull' timed out after 2 seconds",
|
||||
\ 'type': 'E'
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#dafny#dafny#Handle(0, [
|
||||
\ 'File.dfy(123,45): Error BP5002: A precondition for this call might not hold.',
|
||||
\ 'File.dfy(678,90): Related location: This is the precondition that might not hold.'
|
||||
\ 'File.dfy(678,90): Related location: This is the precondition that might not hold.',
|
||||
\ "File.dfy(123,45): Verification of 'Impl$$_22_Proof.__default.PutKeepsMapsFull' timed out after 2 seconds",
|
||||
\ ])
|
||||
|
||||
@@ -482,6 +482,7 @@ Execute(We should include several important flags):
|
||||
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
|
||||
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
|
||||
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
|
||||
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
|
||||
\ . ' -Dmacro="value"'
|
||||
\ . ' -DGoal=9'
|
||||
\ . ' -D macro2'
|
||||
@@ -511,6 +512,8 @@ Execute(We should include several important flags):
|
||||
\ 'incframework',
|
||||
\ '-include',
|
||||
\ '''foo bar''',
|
||||
\ '-imacros',
|
||||
\ 'incmacros',
|
||||
\ '-Dmacro="value"',
|
||||
\ '-DGoal=9',
|
||||
\ '-D',
|
||||
@@ -559,6 +562,7 @@ Execute(We should quote the flags we need to quote):
|
||||
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
|
||||
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
|
||||
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
|
||||
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
|
||||
\ . ' ' . ale#Escape('-Dmacro="value"')
|
||||
\ . ' -DGoal=9'
|
||||
\ . ' -D macro2'
|
||||
@@ -591,6 +595,8 @@ Execute(We should quote the flags we need to quote):
|
||||
\ 'incframework',
|
||||
\ '-include',
|
||||
\ '''foo bar''',
|
||||
\ '-imacros',
|
||||
\ 'incmacros',
|
||||
\ '-Dmacro="value"',
|
||||
\ '-DGoal=9',
|
||||
\ '-D',
|
||||
|
||||
@@ -111,7 +111,7 @@ Execute(An initial list of semantic errors should be handled):
|
||||
|
||||
Assert g:ale_handle_loclist_called
|
||||
|
||||
Execute(Subsequent empty lists should be ignored):
|
||||
Execute(Subsequent empty lists should be ignored - semantic):
|
||||
let g:ale_buffer_info[bufnr('')].semantic_loclist = []
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', ''))
|
||||
@@ -138,3 +138,31 @@ Execute(Non-empty then non-empty semantic errors should be handled):
|
||||
call ale#lsp_linter#HandleLSPResponse(1, CreateError('semanticDiag', 'x'))
|
||||
|
||||
Assert g:ale_handle_loclist_called
|
||||
|
||||
Execute(Subsequent empty lists should be ignored - suggestion):
|
||||
let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
|
||||
|
||||
Assert !g:ale_handle_loclist_called
|
||||
|
||||
Execute(Empty then non-empty suggestion messages should be handled):
|
||||
let g:ale_buffer_info[bufnr('')].suggestion_loclist = []
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
|
||||
|
||||
Assert g:ale_handle_loclist_called
|
||||
|
||||
Execute(Non-empty then empt suggestion messages should be handled):
|
||||
let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', ''))
|
||||
|
||||
Assert g:ale_handle_loclist_called
|
||||
|
||||
Execute(Non-empty then non-empty suggestion messages should be handled):
|
||||
let g:ale_buffer_info[bufnr('')].suggestion_loclist = CreateLoclist('x')
|
||||
|
||||
call ale#lsp_linter#HandleLSPResponse(1, CreateError('suggestionDiag', 'x'))
|
||||
|
||||
Assert g:ale_handle_loclist_called
|
||||
|
||||
Reference in New Issue
Block a user