summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_elixir_credo.vader7
-rw-r--r--test/command_callback/test_julia_languageserver_callbacks.vader8
-rw-r--r--test/command_callback/test_rust_analyzer_callbacks.vader4
-rw-r--r--test/fixers/test_dhall_fixer_callback.vader11
-rw-r--r--test/fixers/test_dhall_format_fixer_callback.vader24
-rw-r--r--test/fixers/test_dhall_freeze_fixer_callback.vader24
-rw-r--r--test/fixers/test_dhall_lint_fixer_callback.vader22
-rw-r--r--test/handler/test_dafny_handler.vader12
-rw-r--r--test/test_c_flag_parsing.vader6
-rw-r--r--test/test_redundant_tsserver_rendering_avoided.vader30
10 files changed, 128 insertions, 20 deletions
diff --git a/test/command_callback/test_elixir_credo.vader b/test/command_callback/test_elixir_credo.vader
index 3eb88846..b14444c6 100644
--- a/test/command_callback/test_elixir_credo.vader
+++ b/test/command_callback/test_elixir_credo.vader
@@ -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'
diff --git a/test/command_callback/test_julia_languageserver_callbacks.vader b/test/command_callback/test_julia_languageserver_callbacks.vader
index 3bc46e3d..96df81f1 100644
--- a/test/command_callback/test_julia_languageserver_callbacks.vader
+++ b/test/command_callback/test_julia_languageserver_callbacks.vader
@@ -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 ''
diff --git a/test/command_callback/test_rust_analyzer_callbacks.vader b/test/command_callback/test_rust_analyzer_callbacks.vader
index 95866076..efab1378 100644
--- a/test/command_callback/test_rust_analyzer_callbacks.vader
+++ b/test/command_callback/test_rust_analyzer_callbacks.vader
@@ -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']}}
diff --git a/test/fixers/test_dhall_fixer_callback.vader b/test/fixers/test_dhall_fixer_callback.vader
deleted file mode 100644
index f27880b7..00000000
--- a/test/fixers/test_dhall_fixer_callback.vader
+++ /dev/null
@@ -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'
- \ }
diff --git a/test/fixers/test_dhall_format_fixer_callback.vader b/test/fixers/test_dhall_format_fixer_callback.vader
new file mode 100644
index 00000000..9bc17f7e
--- /dev/null
+++ b/test/fixers/test_dhall_format_fixer_callback.vader
@@ -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,
+ \ }
diff --git a/test/fixers/test_dhall_freeze_fixer_callback.vader b/test/fixers/test_dhall_freeze_fixer_callback.vader
new file mode 100644
index 00000000..c8f820bb
--- /dev/null
+++ b/test/fixers/test_dhall_freeze_fixer_callback.vader
@@ -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,
+ \ }
diff --git a/test/fixers/test_dhall_lint_fixer_callback.vader b/test/fixers/test_dhall_lint_fixer_callback.vader
new file mode 100644
index 00000000..82229363
--- /dev/null
+++ b/test/fixers/test_dhall_lint_fixer_callback.vader
@@ -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,
+ \ }
diff --git a/test/handler/test_dafny_handler.vader b/test/handler/test_dafny_handler.vader
index 797d348e..472615ac 100644
--- a/test/handler/test_dafny_handler.vader
+++ b/test/handler/test_dafny_handler.vader
@@ -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",
\ ])
diff --git a/test/test_c_flag_parsing.vader b/test/test_c_flag_parsing.vader
index 99722b17..8b02f2b9 100644
--- a/test/test_c_flag_parsing.vader
+++ b/test/test_c_flag_parsing.vader
@@ -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',
diff --git a/test/test_redundant_tsserver_rendering_avoided.vader b/test/test_redundant_tsserver_rendering_avoided.vader
index 6125ebc2..bde5d152 100644
--- a/test/test_redundant_tsserver_rendering_avoided.vader
+++ b/test/test_redundant_tsserver_rendering_avoided.vader
@@ -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