summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_c_clang_tidy_command_callback.vader7
-rw-r--r--test/command_callback/test_c_import_paths.vader2
-rw-r--r--test/command_callback/test_clang_tidy_command_callback.vader21
-rw-r--r--test/command_callback/test_cpp_clazy_command_callback.vader59
-rw-r--r--test/command_callback/test_dockerfile_lint_command_callback.vader19
-rw-r--r--test/fix/test_ale_fix.vader9
-rw-r--r--test/fixers/test_rubocop_fixer_callback.vader6
-rw-r--r--test/handler/test_dockerfile_lint_handler.vader108
-rw-r--r--test/handler/test_swipl_handler.vader95
-rw-r--r--test/smoke_test.vader8
-rw-r--r--test/test_alejobstarted_autocmd.vader11
-rw-r--r--test/test_alelint_autocmd.vader19
-rw-r--r--test/test_checkingbuffer_autocmd.vader6
-rw-r--r--test/test_command_chain.vader2
-rw-r--r--test/test_engine_lsp_response_handling.vader2
-rw-r--r--test/test_history_saving.vader6
-rw-r--r--test/test_ignoring_linters.vader8
-rw-r--r--test/test_lint_file_linters.vader1
-rw-r--r--test/test_linter_type_mapping.vader12
-rw-r--r--test/test_linting_blacklist.vader2
-rw-r--r--test/test_loclist_corrections.vader45
-rw-r--r--test/test_other_sources.vader153
-rw-r--r--test/test_redundant_tsserver_rendering_avoided.vader2
-rw-r--r--test/test_sandbox_execution.vader1
-rw-r--r--test/test_setting_problems_found_in_previous_buffers.vader4
-rw-r--r--test/test_temporary_file_management.vader4
-rw-r--r--test/test_verilog_verilator_options.vader2
27 files changed, 526 insertions, 88 deletions
diff --git a/test/command_callback/test_c_clang_tidy_command_callback.vader b/test/command_callback/test_c_clang_tidy_command_callback.vader
index 582d4798..f78d0ea7 100644
--- a/test/command_callback/test_c_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_c_clang_tidy_command_callback.vader
@@ -7,7 +7,7 @@ After:
Execute(The clangtidy command default should be correct):
AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s'
+ \ ale#Escape('clang-tidy') . ' %s'
Execute(You should be able to remove the -checks option for clang-tidy):
let b:ale_c_clangtidy_checks = []
@@ -23,12 +23,14 @@ Execute(You should be able to set other checks for clang-tidy):
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
Execute(You should be able to manually set compiler flags for clang-tidy):
+ let b:ale_c_clangtidy_checks = ['*']
let b:ale_c_clangtidy_options = '-Wall'
AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
Execute(The build directory should be configurable):
+ let b:ale_c_clangtidy_checks = ['*']
let b:ale_c_build_dir = '/foo/bar'
AssertLinter 'clang-tidy',
@@ -37,6 +39,7 @@ Execute(The build directory should be configurable):
\ . ' -p ' . ale#Escape('/foo/bar')
Execute(The build directory setting should override the options):
+ let b:ale_c_clangtidy_checks = ['*']
let b:ale_c_build_dir = '/foo/bar'
let b:ale_c_clangtidy_options = '-Wall'
@@ -48,6 +51,7 @@ Execute(The build directory setting should override the options):
Execute(The build directory should be ignored for header files):
call ale#test#SetFilename('test.h')
+ let b:ale_c_clangtidy_checks = ['*']
let b:ale_c_build_dir = '/foo/bar'
let b:ale_c_clangtidy_options = '-Wall'
@@ -61,6 +65,7 @@ Execute(The build directory should be ignored for header files):
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
Execute(The executable should be configurable):
+ let b:ale_c_clangtidy_checks = ['*']
let b:ale_c_clangtidy_executable = 'foobar'
AssertLinter 'foobar',
diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader
index 80fff57b..0b5fac40 100644
--- a/test/command_callback/test_c_import_paths.vader
+++ b/test/command_callback/test_c_import_paths.vader
@@ -219,5 +219,5 @@ Execute(The C++ ClangTidy handler should include json folders for projects with
AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy')
- \ . ' -checks=' . ale#Escape('*') . ' %s '
+ \ . ' %s '
\ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/json_project/build'))
diff --git a/test/command_callback/test_clang_tidy_command_callback.vader b/test/command_callback/test_clang_tidy_command_callback.vader
index f28609ee..3297a4cb 100644
--- a/test/command_callback/test_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_clang_tidy_command_callback.vader
@@ -7,12 +7,13 @@ After:
Execute(The clangtidy command default should be correct):
AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s'
+ \ ale#Escape('clang-tidy') . ' %s'
Execute(You should be able to remove the -checks option for clang-tidy):
let b:ale_cpp_clangtidy_checks = []
- AssertLinter 'clang-tidy', ale#Escape('clang-tidy') . ' %s'
+ 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-*']
@@ -22,34 +23,41 @@ Execute(You should be able to set other checks for clang-tidy):
\ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
Execute(You should be able to manually set compiler flags for clang-tidy):
+ let b:ale_cpp_clangtidy_checks = ['*']
let b:ale_cpp_clangtidy_options = '-Wall'
AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
- \
+
Execute(The build directory should be configurable):
+ let b:ale_cpp_clangtidy_checks = ['*']
let b:ale_c_build_dir = '/foo/bar'
AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy')
- \ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar')
+ \ . ' -checks=' . ale#Escape('*') . ' %s'
+ \ . ' -p ' . ale#Escape('/foo/bar')
Execute(The build directory setting should override the options):
+ let b:ale_cpp_clangtidy_checks = ['*']
let b:ale_c_build_dir = '/foo/bar'
let b:ale_cpp_clangtidy_options = '-Wall'
AssertLinter 'clang-tidy',
\ ale#Escape('clang-tidy')
- \ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar')
+ \ . ' -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')
+ let b:ale_cpp_clangtidy_checks = ['*']
let b:ale_c_build_dir = '/foo/bar'
let b:ale_cpp_clangtidy_options = '-Wall'
AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
+ \ ale#Escape('clang-tidy')
+ \ . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
call ale#test#SetFilename('test.hpp')
@@ -57,6 +65,7 @@ Execute(The build directory should be ignored for header files):
\ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
Execute(The executable should be configurable):
+ let b:ale_cpp_clangtidy_checks = ['*']
let b:ale_cpp_clangtidy_executable = 'foobar'
AssertLinter 'foobar',
diff --git a/test/command_callback/test_cpp_clazy_command_callback.vader b/test/command_callback/test_cpp_clazy_command_callback.vader
index f28609ee..1be43b96 100644
--- a/test/command_callback/test_cpp_clazy_command_callback.vader
+++ b/test/command_callback/test_cpp_clazy_command_callback.vader
@@ -1,63 +1,54 @@
Before:
- call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
+ call ale#assert#SetUpLinterTest('cpp', 'clazy')
call ale#test#SetFilename('test.cpp')
After:
call ale#assert#TearDownLinterTest()
-Execute(The clangtidy command default should be correct):
- AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s'
+Execute(The clazy command default should be correct):
+ AssertLinter 'clazy-standalone',
+ \ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' %s'
-Execute(You should be able to remove the -checks option for clang-tidy):
- let b:ale_cpp_clangtidy_checks = []
+Execute(You should be able to remove the -checks option for clazy-standalone):
+ let b:ale_cpp_clazy_checks = []
- AssertLinter 'clang-tidy', ale#Escape('clang-tidy') . ' %s'
+ AssertLinter 'clazy-standalone', ale#Escape('clazy-standalone') . ' %s'
-Execute(You should be able to set other checks for clang-tidy):
- let b:ale_cpp_clangtidy_checks = ['-*', 'clang-analyzer-*']
+Execute(You should be able to set other checks for clazy-standalone):
+ let b:ale_cpp_clazy_checks = ['level2', 'level3']
- AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy')
- \ . ' -checks=' . ale#Escape('-*,clang-analyzer-*') . ' %s'
+ AssertLinter 'clazy-standalone',
+ \ ale#Escape('clazy-standalone')
+ \ . ' -checks=' . ale#Escape('level2,level3') . ' %s'
-Execute(You should be able to manually set compiler flags for clang-tidy):
- let b:ale_cpp_clangtidy_options = '-Wall'
+Execute(You should be able to manually set compiler flags for clazy-standalone):
+ let b:ale_cpp_clazy_options = '-qt4-compat'
- AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
+ AssertLinter 'clazy-standalone',
+ \ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' -qt4-compat' . ' %s'
\
Execute(The build directory should be configurable):
let b:ale_c_build_dir = '/foo/bar'
- AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy')
- \ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar')
-
-Execute(The build directory setting should override the options):
- let b:ale_c_build_dir = '/foo/bar'
- let b:ale_cpp_clangtidy_options = '-Wall'
-
- AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy')
- \ . ' -checks=' . ale#Escape('*') . ' %s -p ' . ale#Escape('/foo/bar')
+ AssertLinter 'clazy-standalone',
+ \ ale#Escape('clazy-standalone')
+ \ . ' -checks=' . ale#Escape('level1') . ' -p ' . ale#Escape('/foo/bar') . ' %s'
Execute(The build directory should be ignored for header files):
call ale#test#SetFilename('test.h')
let b:ale_c_build_dir = '/foo/bar'
- let b:ale_cpp_clangtidy_options = '-Wall'
- AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
+ AssertLinter 'clazy-standalone',
+ \ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' %s'
call ale#test#SetFilename('test.hpp')
- AssertLinter 'clang-tidy',
- \ ale#Escape('clang-tidy') . ' -checks=' . ale#Escape('*') . ' %s -- -Wall'
+ AssertLinter 'clazy-standalone',
+ \ ale#Escape('clazy-standalone') . ' -checks=' . ale#Escape('level1') . ' %s'
Execute(The executable should be configurable):
- let b:ale_cpp_clangtidy_executable = 'foobar'
+ let b:ale_cpp_clazy_executable = 'foobar'
AssertLinter 'foobar',
- \ ale#Escape('foobar') . ' -checks=' . ale#Escape('*') . ' %s'
+ \ ale#Escape('foobar') . ' -checks=' . ale#Escape('level1') . ' %s'
diff --git a/test/command_callback/test_dockerfile_lint_command_callback.vader b/test/command_callback/test_dockerfile_lint_command_callback.vader
new file mode 100644
index 00000000..abc32e0d
--- /dev/null
+++ b/test/command_callback/test_dockerfile_lint_command_callback.vader
@@ -0,0 +1,19 @@
+Before:
+ call ale#assert#SetUpLinterTest('dockerfile', 'dockerfile_lint')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'dockerfile_lint', ale#Escape('dockerfile_lint') . ' -p -j -f %t'
+
+Execute(The executable should be configurable):
+ let b:ale_dockerfile_dockerfile_lint_executable = 'foobar'
+
+ AssertLinter 'foobar', ale#Escape('foobar') . ' -p -j -f %t'
+
+Execute(The options should be configurable):
+ let b:ale_dockerfile_dockerfile_lint_options = '-r additional.yaml'
+
+ AssertLinter 'dockerfile_lint', ale#Escape('dockerfile_lint') . ' -r additional.yaml -p -j -f %t'
+
diff --git a/test/fix/test_ale_fix.vader b/test/fix/test_ale_fix.vader
index 67b8b212..539972a4 100644
--- a/test/fix/test_ale_fix.vader
+++ b/test/fix/test_ale_fix.vader
@@ -23,7 +23,7 @@ Before:
autocmd!
autocmd User ALEFixPre let g:pre_success = 1
autocmd User ALEFixPost let g:post_success = 1
- augroup end
+ augroup END
if !has('win32')
let &shell = '/bin/bash'
@@ -180,7 +180,6 @@ After:
unlet! g:ale_emulate_job_failure
unlet! b:ale_fixers
unlet! b:ale_fix_on_save
- augroup! VaderTest
delfunction AddCarets
delfunction AddDollars
delfunction DoNothing
@@ -204,6 +203,12 @@ After:
delfunction FixWithJSONPostProcessing
delfunction JSONPostProcessor
+ augroup VaderTest
+ autocmd!
+ augroup END
+
+ augroup! VaderTest
+
call ale#test#RestoreDirectory()
call ale#fix#registry#ResetToDefaults()
diff --git a/test/fixers/test_rubocop_fixer_callback.vader b/test/fixers/test_rubocop_fixer_callback.vader
index 045256f8..866326bf 100644
--- a/test/fixers/test_rubocop_fixer_callback.vader
+++ b/test/fixers/test_rubocop_fixer_callback.vader
@@ -23,7 +23,7 @@ Execute(The rubocop callback should return the correct default values):
\ {
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
- \ . ' --auto-correct %t',
+ \ . ' --auto-correct --force-exclusion %t',
\ },
\ ale#fixers#rubocop#Fix(bufnr(''))
@@ -35,7 +35,7 @@ Execute(The rubocop callback should include configuration files):
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
- \ . ' --auto-correct %t',
+ \ . ' --auto-correct --force-exclusion %t',
\ },
\ ale#fixers#rubocop#Fix(bufnr(''))
@@ -49,6 +49,6 @@ Execute(The rubocop callback should include custom rubocop options):
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
\ . ' --config ' . ale#Escape(ale#path#Simplify(g:dir . '/ruby_paths/with_config/.rubocop.yml'))
\ . ' --except Lint/Debugger'
- \ . ' --auto-correct %t',
+ \ . ' --auto-correct --force-exclusion %t',
\ },
\ ale#fixers#rubocop#Fix(bufnr(''))
diff --git a/test/handler/test_dockerfile_lint_handler.vader b/test/handler/test_dockerfile_lint_handler.vader
new file mode 100644
index 00000000..619b7bde
--- /dev/null
+++ b/test/handler/test_dockerfile_lint_handler.vader
@@ -0,0 +1,108 @@
+Before:
+ runtime ale_linters/dockerfile/dockerfile_lint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The dockerfile_lint handler should handle broken JSON):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{asdf"])
+
+Execute(The dockerfile_lint handler should handle an empty string response):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [])
+
+Execute(The dockerfile_lint handler should handle an empty result, even if it shouldn't happen):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{}"])
+
+Execute(The dockerfile_lint handler should handle a normal example):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'E',
+ \ 'text': "Required LABEL name/key 'Name' is not defined",
+ \ },
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'E',
+ \ 'text': "Required LABEL name/key 'Version' is not defined",
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'type': 'I',
+ \ 'text': "the MAINTAINER command is deprecated. MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",
+ \ },
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'I',
+ \ 'text': "There is no 'CMD' instruction",
+ \ },
+ \ ],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [
+ \ '{',
+ \ ' "error": {',
+ \ ' "count": 2,',
+ \ ' "data": [',
+ \ ' {',
+ \ " \"message\": \"Required LABEL name/key 'Name' is not defined\",",
+ \ ' "line": -1,',
+ \ ' "level": "error",',
+ \ ' "lineContent": "",',
+ \ ' "reference_url": [',
+ \ ' "http://docs.projectatomic.io/container-best-practices/#",',
+ \ ' "_recommended_labels_for_your_project"',
+ \ ' ]',
+ \ ' },',
+ \ ' {',
+ \ " \"message\": \"Required LABEL name/key 'Version' is not defined\",",
+ \ ' "line": -1,',
+ \ ' "level": "error",',
+ \ ' "lineContent": "",',
+ \ ' "reference_url": [',
+ \ ' "http://docs.projectatomic.io/container-best-practices/#",',
+ \ ' "_recommended_labels_for_your_project"',
+ \ ' ]',
+ \ ' }',
+ \ ' ]',
+ \ ' },',
+ \ ' "warn": {',
+ \ ' "count": 0,',
+ \ ' "data": []',
+ \ ' },',
+ \ ' "info": {',
+ \ ' "count": 2,',
+ \ ' "data": [',
+ \ ' {',
+ \ ' "label": "maintainer_deprecated",',
+ \ ' "regex": {},',
+ \ ' "level": "info",',
+ \ ' "message": "the MAINTAINER command is deprecated",',
+ \ ' "description": "MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",',
+ \ ' "reference_url": [',
+ \ ' "https://github.com/docker/cli/blob/master/docs/deprecated.md",',
+ \ ' "#maintainer-in-dockerfile"',
+ \ ' ],',
+ \ ' "lineContent": "MAINTAINER Alexander Olofsson <ace@haxalot.com>",',
+ \ ' "line": 3',
+ \ ' },',
+ \ ' {',
+ \ ' "instruction": "CMD",',
+ \ ' "count": 1,',
+ \ ' "level": "info",',
+ \ " \"message\": \"There is no 'CMD' instruction\",",
+ \ ' "description": "None",',
+ \ ' "reference_url": [',
+ \ ' "https://docs.docker.com/engine/reference/builder/",',
+ \ ' "#cmd"',
+ \ ' ]',
+ \ ' }',
+ \ ' ]',
+ \ ' },',
+ \ ' "summary": []',
+ \ '}',
+ \ ])
diff --git a/test/handler/test_swipl_handler.vader b/test/handler/test_swipl_handler.vader
new file mode 100644
index 00000000..9e425cf6
--- /dev/null
+++ b/test/handler/test_swipl_handler.vader
@@ -0,0 +1,95 @@
+Before:
+ runtime ale_linters/prolog/swipl.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute (The swipl handler should handle oneline warning / error):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 5,
+ \ 'col': 1,
+ \ 'text': 'Syntax error: Operator expected',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'ERROR: /path/to/test.pl:5:1: Syntax error: Operator expected',
+ \ ])
+
+Execute (The swipl handler should handle a warning / error of two lines):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 9,
+ \ 'col': 0,
+ \ 'text': 'Singleton variables: [M]',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'Warning: /path/to/test.pl:9:',
+ \ ' Singleton variables: [M]',
+ \ ])
+
+Execute (The swipl handler should join three or more lines with '. '):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 10,
+ \ 'col': 0,
+ \ 'text': 'Clauses of fib/2 are not together in the source-file. Earlier definition at /path/to/test.pl:7. Current predicate: f/0. Use :- discontiguous fib/2. to suppress this message',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'Warning: /path/to/test.pl:10:',
+ \ ' Clauses of fib/2 are not together in the source-file',
+ \ ' Earlier definition at /path/to/test.pl:7',
+ \ ' Current predicate: f/0',
+ \ ' Use :- discontiguous fib/2. to suppress this message',
+ \ ])
+
+Execute (The swipl handler should ignore warnings / errors 'No permission to call sandboxed ...'):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'ERROR: /path/to/test.pl:11:',
+ \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G3416:_G3417,_G3413,_G3414)''',
+ \ ' Reachable from:',
+ \ ' system:''$set_pattr''(A,B,C,D)',
+ \ ' system:''$set_pattr''(vimscript:A,B,C)',
+ \ ' vimscript: (multifile A)',
+ \ 'ERROR: /path/to/test.pl:12:',
+ \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G205:_G206,_G202,_G203)''',
+ \ ' Reachable from:',
+ \ ' system:''$set_pattr''(A,B,C,D)',
+ \ ' system:''$set_pattr''(vimscript:A,B,C)',
+ \ ' vimscript: (multifile A)',
+ \ 'ERROR: /path/to/test.pl:13:',
+ \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G1808:_G1809,_G1805,_G1806)''',
+ \ ' Reachable from:',
+ \ ' system:''$set_pattr''(A,B,C,D)',
+ \ ' system:''$set_pattr''(vimscript:A,B,C)',
+ \ ' vimscript: (multifile A)',
+ \ ])
+
+Execute (The swipl handler should handle a warning / error with no line number):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 0,
+ \ 'text': 'Exported procedure module_name:pred/0 is not defined',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'ERROR: Exported procedure module_name:pred/0 is not defined',
+ \ ])
diff --git a/test/smoke_test.vader b/test/smoke_test.vader
index 2708c86f..c87f95b2 100644
--- a/test/smoke_test.vader
+++ b/test/smoke_test.vader
@@ -65,7 +65,7 @@ Execute(Linters should run with the default options):
" Try the test a few times over in NeoVim 0.3 or Windows,
" where tests fail randomly.
for g:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
- call ale#Lint()
+ call ale#Queue(0, '')
call ale#engine#WaitForJobs(2000)
let g:results = ale#test#GetLoclistWithoutModule()
@@ -109,7 +109,7 @@ Execute(Linters should run in PowerShell too):
\ 'command': 'echo foo && echo bar',
\})
- call ale#Lint()
+ call ale#Queue(0, '')
call ale#engine#WaitForJobs(4000)
AssertEqual [
@@ -139,7 +139,7 @@ Execute(Linters should run in PowerShell too):
endif
Execute(Previous errors should be removed when linters change):
- call ale#Lint()
+ call ale#Queue(0, '')
call ale#engine#WaitForJobs(2000)
call ale#linter#Reset()
@@ -166,7 +166,7 @@ Execute(Previous errors should be removed when linters change):
" Try the test a few times over in NeoVim 0.3 or Windows,
" where tests fail randomly.
for g:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
- call ale#Lint()
+ call ale#Queue(0, '')
call ale#engine#WaitForJobs(2000)
let g:results = ale#test#GetLoclistWithoutModule()
diff --git a/test/test_alejobstarted_autocmd.vader b/test/test_alejobstarted_autocmd.vader
index 388e5439..6fa1ff8e 100644
--- a/test/test_alejobstarted_autocmd.vader
+++ b/test/test_alejobstarted_autocmd.vader
@@ -23,10 +23,11 @@ After:
let g:ale_run_synchronously = 0
- try
- augroup! VaderTest
- catch
- endtry
+ augroup VaderTest
+ autocmd!
+ augroup END
+
+ augroup! VaderTest
unlet! g:job_started_success
@@ -38,7 +39,7 @@ Execute(Run a lint cycle with an actual job to check for ALEJobStarted):
augroup VaderTest
autocmd!
autocmd User ALEJobStarted let g:job_started_success = 1
- augroup end
+ augroup END
ALELint
diff --git a/test/test_alelint_autocmd.vader b/test/test_alelint_autocmd.vader
index 5af1cd47..332cb36f 100644
--- a/test/test_alelint_autocmd.vader
+++ b/test/test_alelint_autocmd.vader
@@ -9,20 +9,21 @@ After:
let g:ale_run_synchronously = 0
let g:ale_buffer_info = {}
- try
- augroup! VaderTest
- catch
- endtry
+ augroup VaderTest
+ autocmd!
+ augroup END
+
+ augroup! VaderTest
-Given foobar(An empty file):
+Given testft(An empty file):
Execute(Run a lint cycle, and check that a variable is set in the autocmd):
augroup VaderTest
autocmd!
autocmd User ALELintPre let g:pre_success = 1
autocmd User ALELintPost let g:post_success = 1
- augroup end
+ augroup END
- call ale#Lint()
+ call ale#Queue(0)
AssertEqual g:pre_success, 1
AssertEqual g:post_success, 1
@@ -30,10 +31,10 @@ Execute(Run a lint cycle, and check that a variable is set in the autocmd):
Execute(b:ale_linted should be increased after each lint cycle):
AssertEqual get(b:, 'ale_linted'), 0
- call ale#Lint()
+ call ale#Queue(0)
AssertEqual get(b:, 'ale_linted'), 1
- call ale#Lint()
+ call ale#Queue(0)
AssertEqual get(b:, 'ale_linted'), 2
diff --git a/test/test_checkingbuffer_autocmd.vader b/test/test_checkingbuffer_autocmd.vader
index 9e3a8188..9e642b15 100644
--- a/test/test_checkingbuffer_autocmd.vader
+++ b/test/test_checkingbuffer_autocmd.vader
@@ -31,7 +31,7 @@ After:
augroup VaderTest
autocmd!
- augroup end
+ augroup END
augroup! VaderTest
@@ -40,7 +40,7 @@ Execute(ALELintPre should not return success on ale#engine#IsCheckingBuffer):
augroup VaderTest
autocmd!
autocmd User ALELintPre let g:checking_buffer = ale#engine#IsCheckingBuffer(bufnr('')) ? 1 : 0
- augroup end
+ augroup END
ALELint
@@ -50,7 +50,7 @@ Execute(ALEJobStarted should return success on ale#engine#IsCheckingBuffer):
augroup VaderTest
autocmd!
autocmd User ALEJobStarted let g:checking_buffer = ale#engine#IsCheckingBuffer(bufnr('')) ? 1 : 0
- augroup end
+ augroup END
ALELint
diff --git a/test/test_command_chain.vader b/test/test_command_chain.vader
index 9059d630..591f6f40 100644
--- a/test/test_command_chain.vader
+++ b/test/test_command_chain.vader
@@ -62,7 +62,7 @@ Given foobar (Some imaginary filetype):
Execute(Check the results of running the chain):
AssertEqual 'foobar', &filetype
- call ale#Lint()
+ call ale#Queue(0)
Assert g:first_echo_called, 'The first chain item was not called'
Assert g:second_echo_called, 'The second chain item was not called'
diff --git a/test/test_engine_lsp_response_handling.vader b/test/test_engine_lsp_response_handling.vader
index 818659db..04f12ad6 100644
--- a/test/test_engine_lsp_response_handling.vader
+++ b/test/test_engine_lsp_response_handling.vader
@@ -2,6 +2,8 @@ Before:
Save g:ale_buffer_info
Save g:ale_lsp_error_messages
+ let g:ale_buffer_info = {}
+
unlet! g:ale_lsp_error_messages
call ale#test#SetDirectory('/testplugin/test')
diff --git a/test/test_history_saving.vader b/test/test_history_saving.vader
index 375e96a1..d7a307b5 100644
--- a/test/test_history_saving.vader
+++ b/test/test_history_saving.vader
@@ -73,7 +73,7 @@ Execute(History should be set when commands are run):
" Retry this test until it works. This one can randomly fail.
for g:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
let b:ale_history = []
- call ale#Lint()
+ call ale#Queue(0)
call ale#engine#WaitForJobs(2000)
let g:history = filter(
@@ -106,7 +106,7 @@ Execute(History should be not set when disabled):
let g:ale_history_enabled = 0
- call ale#Lint()
+ call ale#Queue(0)
call ale#engine#WaitForJobs(2000)
AssertEqual [], ale#history#Get(bufnr(''))
@@ -120,7 +120,7 @@ Execute(History should include command output if logging is enabled):
" Retry this test until it works. This one can randomly fail.
for g:i in range(has('nvim-0.3') || has('win32') ? 5 : 1)
let b:ale_history = []
- call ale#Lint()
+ call ale#Queue(0)
call ale#engine#WaitForJobs(2000)
let g:history = ale#history#Get(bufnr(''))
diff --git a/test/test_ignoring_linters.vader b/test/test_ignoring_linters.vader
index 1ddd30e8..866f9e0d 100644
--- a/test/test_ignoring_linters.vader
+++ b/test/test_ignoring_linters.vader
@@ -108,7 +108,7 @@ Before:
let g:run_linters_called = 1
endfunction
- function! ale#engine#HandleLoclist(linter_name, buffer, loclist) abort
+ function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort
let g:loclist = a:loclist
endfunction
@@ -138,6 +138,9 @@ After:
Given foobar(An empty file):
Execute(Global ignore lists should be applied for linters):
+ " We have to set up buffer info so RunLinters is called.
+ let g:ale_buffer_info = {bufnr(''): {}}
+
ALELint
Assert g:run_linters_called, "The mock callback wasn't called"
AssertEqual ['testlinter'], map(g:linters, 'v:val.name')
@@ -147,6 +150,9 @@ Execute(Global ignore lists should be applied for linters):
AssertEqual [], g:linters
Execute(buffer ignore lists should be applied for linters):
+ " We have to set up buffer info so RunLinters is called.
+ let g:ale_buffer_info = {bufnr(''): {}}
+
ALELint
Assert g:run_linters_called, "The mock callback wasn't called"
AssertEqual ['testlinter'], map(g:linters, 'v:val.name')
diff --git a/test/test_lint_file_linters.vader b/test/test_lint_file_linters.vader
index ca093aa8..f67fad44 100644
--- a/test/test_lint_file_linters.vader
+++ b/test/test_lint_file_linters.vader
@@ -10,7 +10,6 @@ Before:
let g:ale_run_synchronously = 1
let g:ale_set_lists_synchronously = 1
let b:ale_save_event_fired = 0
- call ale#ResetLintFileMarkers()
let g:buffer_result = [
\ {
diff --git a/test/test_linter_type_mapping.vader b/test/test_linter_type_mapping.vader
index 0131b5f0..0ec22a56 100644
--- a/test/test_linter_type_mapping.vader
+++ b/test/test_linter_type_mapping.vader
@@ -16,7 +16,7 @@ Execute(It should be possible to remap errors to style errors):
\ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ ],
- \ ale#engine#FixLocList(bufnr(''), 'foo', [
+ \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [
\ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
@@ -35,7 +35,7 @@ Execute(It should be possible to remap errors to style errors with buffer-local
\ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ ],
- \ ale#engine#FixLocList(bufnr(''), 'foo', [
+ \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [
\ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
@@ -54,7 +54,7 @@ Execute(It should be possible to remap warnings to style warnings):
\ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ ],
- \ ale#engine#FixLocList(bufnr(''), 'foo', [
+ \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [
\ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
@@ -73,7 +73,7 @@ Execute(It should be possible to remap style errors to errors):
\ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ ],
- \ ale#engine#FixLocList(bufnr(''), 'foo', [
+ \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [
\ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
@@ -92,7 +92,7 @@ Execute(It should be possible to remap style warnings to warnings):
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ {'type': 'I', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ ],
- \ ale#engine#FixLocList(bufnr(''), 'foo', [
+ \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [
\ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
@@ -111,7 +111,7 @@ Execute(It should be possible to info problems to warnings):
\ {'type': 'W', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1, 'linter_name': 'foo'},
\ ],
- \ ale#engine#FixLocList(bufnr(''), 'foo', [
+ \ ale#engine#FixLocList(bufnr(''), 'foo', 0, [
\ {'type': 'E', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'E', 'sub_type': 'style', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
\ {'type': 'W', 'lnum': 1, 'text': 'x', 'bufnr': bufnr(''), 'col': 0, 'vcol': 0, 'nr': -1},
diff --git a/test/test_linting_blacklist.vader b/test/test_linting_blacklist.vader
index 2d9ed585..73190b7f 100644
--- a/test/test_linting_blacklist.vader
+++ b/test/test_linting_blacklist.vader
@@ -10,7 +10,7 @@ Given unite (A Unite.vim file):
anything
Execute(Running ALE on a blacklisted file shouldn't change anything):
- call ale#Lint()
+ call ale#Queue(0)
call ale#engine#WaitForJobs(2000)
AssertEqual {}, g:ale_buffer_info
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
index 48aa1f78..343620a5 100644
--- a/test/test_loclist_corrections.vader
+++ b/test/test_loclist_corrections.vader
@@ -41,6 +41,7 @@ Execute(FixLocList should set all the default values correctly):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}],
\ )
@@ -61,6 +62,7 @@ Execute(FixLocList should use the values we supply):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{
\ 'text': 'a',
\ 'lnum': 3,
@@ -89,6 +91,7 @@ Execute(FixLocList should set items with lines beyond the end to the last line):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 11}],
\ )
@@ -109,6 +112,7 @@ Execute(FixLocList should move line 0 to line 1):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 0}],
\ )
@@ -130,6 +134,7 @@ Execute(FixLocList should convert line and column numbers correctly):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': '010', 'col': '010'}],
\ )
@@ -163,6 +168,7 @@ Execute(FixLocList should pass on end_col values):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012'},
\ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12},
@@ -200,6 +206,7 @@ Execute(FixLocList should pass on end_lnum values):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': '010', 'col': '010', 'end_col': '012', 'end_lnum': '013'},
\ {'text': 'a', 'lnum': '010', 'col': '011', 'end_col': 12, 'end_lnum': 13},
@@ -224,6 +231,7 @@ Execute(FixLocList should allow subtypes to be set):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 11, 'sub_type': 'style'}],
\ )
@@ -285,6 +293,7 @@ Execute(FixLocList should accept filenames):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': 2, 'filename': expand('%:p')},
\ {'text': 'a', 'lnum': 3, 'filename': expand('%:p')},
@@ -322,6 +331,7 @@ Execute(FixLocList should interpret temporary filenames as being the current buf
\ ale#engine#FixLocList(
\ bufnr(''),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': 2, 'filename': b:temp_name},
\ {'text': 'a', 'lnum': 3, 'filename': substitute(b:temp_name, '\\', '/', 'g')},
@@ -346,9 +356,43 @@ Execute(The error code should be passed on):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [{'text': 'a', 'lnum': 11, 'code': 'some-code'}],
\ )
+Execute(FixLocList should mark problems as coming from other sources if requested):
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 2,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ 'from_other_source': 1,
+ \ },
+ \ {
+ \ 'text': 'b',
+ \ 'lnum': 2,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ 'from_other_source': 1,
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ 'foobar',
+ \ 1,
+ \ [{'text': 'a', 'lnum': 2}, {'text': 'b', 'lnum': 2}],
+ \ )
+
Given(A file with Japanese multi-byte text):
はじめまして!
-私はワープです。
@@ -367,6 +411,7 @@ Execute(character positions should be converted to byte positions):
\ ale#engine#FixLocList(
\ bufnr('%'),
\ 'foobar',
+ \ 0,
\ [
\ {'text': 'a', 'lnum': 1, 'col': 0, 'vcol': 1},
\ {'text': 'a', 'lnum': 1, 'col': 1, 'vcol': 1},
diff --git a/test/test_other_sources.vader b/test/test_other_sources.vader
new file mode 100644
index 00000000..e6f9911c
--- /dev/null
+++ b/test/test_other_sources.vader
@@ -0,0 +1,153 @@
+Before:
+ Save g:ale_buffer_info
+ Save g:ale_set_signs
+ Save g:ale_set_quickfix
+ Save g:ale_set_loclist
+ Save g:ale_set_highlights
+ Save g:ale_echo_cursor
+
+ let g:ale_buffer_info = {}
+ let g:ale_run_synchronously = 1
+ let g:ale_set_lists_synchronously = 1
+ let g:ale_set_signs = 0
+ let g:ale_set_quickfix = 0
+ let g:ale_set_loclist = 1
+ let g:ale_set_highlights = 0
+ let g:ale_echo_cursor = 0
+
+ function! TestCallback(buffer, output)
+ return []
+ endfunction
+
+ call ale#linter#Define('foobar', {
+ \ 'name': 'testlinter',
+ \ 'callback': 'TestCallback',
+ \ 'executable': has('win32') ? 'cmd' : 'echo',
+ \ 'command': has('win32') ? 'echo foo bar' : '/bin/sh -c ''echo foo bar''',
+ \})
+
+After:
+ Restore
+
+ unlet! b:ale_linters
+ unlet! g:want_results_signaled
+ unlet! g:want_results_buffer_value
+ unlet! g:lint_pre_signaled
+ unlet! g:ale_run_synchronously
+ unlet! g:ale_set_lists_synchronously
+
+ delfunction TestCallback
+
+ augroup VaderTest
+ autocmd!
+ augroup END
+
+ augroup! VaderTest
+
+ call ale#linter#Reset()
+ call setloclist(0, [])
+
+Given foobar (Some imaginary filetype):
+Execute(StartChecking should mark a buffer as being actively checked):
+ Assert !ale#engine#IsCheckingBuffer(bufnr(''))
+
+ call ale#other_source#StartChecking(bufnr(''), 'other-source-linter')
+
+ Assert ale#engine#IsCheckingBuffer(bufnr(''))
+
+Execute(ShowResults sould make a buffer inactive):
+ call ale#other_source#StartChecking(bufnr(''), 'other-source-linter')
+ call ale#other_source#StartChecking(bufnr(''), 'second-other-source-linter')
+
+ call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [])
+
+ Assert ale#engine#IsCheckingBuffer(bufnr(''))
+
+ call ale#other_source#ShowResults(bufnr(''), 'second-other-source-linter', [])
+
+ Assert !ale#engine#IsCheckingBuffer(bufnr(''))
+
+Execute(ShowResults should show results at any time):
+ call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [
+ \ {'text': 'xyz', 'lnum': 1},
+ \])
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'bufnr': bufnr(''),
+ \ 'col': 0,
+ \ 'valid': 1,
+ \ 'vcol': 0,
+ \ 'nr': -1,
+ \ 'type': 'E',
+ \ 'pattern': '',
+ \ 'text': 'xyz',
+ \ },
+ \ ],
+ \ ale#test#GetLoclistWithoutModule()
+
+ call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [])
+
+ AssertEqual [], ale#test#GetLoclistWithoutModule()
+
+Execute(A regular lint cycle shouldn't clear results from other sources):
+ call ale#other_source#ShowResults(bufnr(''), 'other-source-linter', [
+ \ {'text': 'xyz', 'lnum': 1},
+ \])
+ ALELint
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'bufnr': bufnr(''),
+ \ 'col': 0,
+ \ 'valid': 1,
+ \ 'vcol': 0,
+ \ 'nr': -1,
+ \ 'type': 'E',
+ \ 'pattern': '',
+ \ 'text': 'xyz',
+ \ },
+ \ ],
+ \ ale#test#GetLoclistWithoutModule()
+
+Execute(ALEWantResults should be signaled when a buffer is checked):
+ augroup VaderTest
+ autocmd!
+ autocmd User ALEWantResults let g:want_results_signaled = 1
+ autocmd User ALELintPre let g:lint_pre_signaled = 1
+ augroup END
+
+ " Even when all linters are disabled, we should send the signal.
+ let b:ale_linters = []
+ ALELint
+
+ Assert get(g:, 'want_results_signaled')
+ Assert !get(g:, 'lint_pre_signaled')
+
+Execute(ALEWantResults should set a variable indicating which buffer is being checked):
+ augroup VaderTest
+ autocmd!
+ autocmd User ALEWantResults let g:want_results_buffer_value = g:ale_want_results_buffer
+ augroup END
+
+ let b:ale_linters = []
+ ALELint
+
+ AssertEqual bufnr(''), g:want_results_buffer_value
+
+Execute(ALEWantResults should lead to an ALELintPre signal if another source responds):
+ augroup VaderTest
+ autocmd!
+ autocmd User ALEWantResults call ale#other_source#StartChecking(bufnr(''), 'other-source-linter')
+ autocmd User ALELintPre let g:lint_pre_signaled = 1
+ augroup END
+
+ " Even when all linters are disabled, we should send the signal.
+ let b:ale_linters = []
+ ALELint
+
+ Assert get(g:, 'lint_pre_signaled')
diff --git a/test/test_redundant_tsserver_rendering_avoided.vader b/test/test_redundant_tsserver_rendering_avoided.vader
index 41cbe5e0..a292b014 100644
--- a/test/test_redundant_tsserver_rendering_avoided.vader
+++ b/test/test_redundant_tsserver_rendering_avoided.vader
@@ -45,7 +45,7 @@ Before:
let g:ale_buffer_info = {bufnr(''): {'loclist': []}}
let g:ale_handle_loclist_called = 0
- function! ale#engine#HandleLoclist(linter_name, buffer, loclist) abort
+ function! ale#engine#HandleLoclist(linter_name, buffer, loclist, from_other_source) abort
let g:ale_handle_loclist_called = 1
endfunction
diff --git a/test/test_sandbox_execution.vader b/test/test_sandbox_execution.vader
index 4dbcb0db..5a4974ba 100644
--- a/test/test_sandbox_execution.vader
+++ b/test/test_sandbox_execution.vader
@@ -47,7 +47,6 @@ Execute(ALE shouldn't blow up when run from a sandbox):
sandbox call ale#Queue(0)
sandbox call ale#Queue(1)
- sandbox call ale#Lint()
Execute(ALE shouldn't blow up if file cleanup happens in a sandbox):
" Make a call to an engine function first, so the function will be defined
diff --git a/test/test_setting_problems_found_in_previous_buffers.vader b/test/test_setting_problems_found_in_previous_buffers.vader
index 4604005a..36eeb4ca 100644
--- a/test/test_setting_problems_found_in_previous_buffers.vader
+++ b/test/test_setting_problems_found_in_previous_buffers.vader
@@ -9,14 +9,14 @@ Before:
let g:ale_buffer_info = {}
call ale#engine#InitBufferInfo(bufnr('') + 1)
let g:ale_buffer_info[bufnr('') + 1].loclist =
- \ ale#engine#FixLocList(bufnr('') + 1, 'linter_one', [
+ \ ale#engine#FixLocList(bufnr('') + 1, 'linter_one', 0, [
\ {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'},
\ {'lnum': 2, 'filename': expand('%:p'), 'text': 'bar'},
\ {'lnum': 2, 'text': 'ignore this one'},
\ ])
call ale#engine#InitBufferInfo(bufnr('') + 2)
let g:ale_buffer_info[bufnr('') + 2].loclist =
- \ ale#engine#FixLocList(bufnr('') + 2, 'linter_one', [
+ \ ale#engine#FixLocList(bufnr('') + 2, 'linter_one', 0, [
\ {'lnum': 1, 'filename': expand('%:p'), 'text': 'foo'},
\ {'lnum': 3, 'filename': expand('%:p'), 'text': 'baz'},
\ {'lnum': 5, 'text': 'ignore this one'},
diff --git a/test/test_temporary_file_management.vader b/test/test_temporary_file_management.vader
index e248331c..4847706a 100644
--- a/test/test_temporary_file_management.vader
+++ b/test/test_temporary_file_management.vader
@@ -67,7 +67,7 @@ Given foobar (Some imaginary filetype):
Execute(ALE should delete managed files/directories appropriately after linting):
AssertEqual 'foobar', &filetype
- call ale#Lint()
+ call ale#Queue(0)
call ale#engine#WaitForJobs(2000)
Assert !filereadable(g:filename), 'The temporary file was not deleted'
@@ -79,7 +79,7 @@ Execute(ALE should delete managed files even if no command is run):
let g:command = ''
- call ale#Lint()
+ call ale#Queue(0)
call ale#engine#WaitForJobs(2000)
Assert !filereadable(g:filename), 'The temporary file was not deleted'
diff --git a/test/test_verilog_verilator_options.vader b/test/test_verilog_verilator_options.vader
index e53037b1..3ebabfcc 100644
--- a/test/test_verilog_verilator_options.vader
+++ b/test/test_verilog_verilator_options.vader
@@ -12,7 +12,7 @@ Execute(Set Verilog Verilator linter additional options to `-sv --default-langua
" Additional args for the linter
let g:ale_verilog_verilator_options = '-sv --default-language "1800-2012"'
- call ale#Lint()
+ call ale#Queue(0)
let g:run_cmd = ale_linters#verilog#verilator#GetCommand(bufnr(''))
let g:matched = match(g:run_cmd, '\s' . g:ale_verilog_verilator_options . '\s')