summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/test_c_cc_command_callbacks.vader55
-rw-r--r--test/command_callback/test_c_clang_command_callbacks.vader20
-rw-r--r--test/command_callback/test_c_gcc_command_callbacks.vader22
-rw-r--r--test/command_callback/test_c_import_paths.vader154
-rw-r--r--test/command_callback/test_cpp_clang_command_callbacks.vader19
-rw-r--r--test/command_callback/test_cpp_gcc_command_callbacks.vader43
-rw-r--r--test/command_callback/test_elixir_credo.vader12
-rw-r--r--test/command_callback/test_markdown_markdownlint_command_callback.vader13
-rw-r--r--test/command_callback/test_swift_swiftformat_command_callbacks.vader25
9 files changed, 178 insertions, 185 deletions
diff --git a/test/command_callback/test_c_cc_command_callbacks.vader b/test/command_callback/test_c_cc_command_callbacks.vader
new file mode 100644
index 00000000..9d71d941
--- /dev/null
+++ b/test/command_callback/test_c_cc_command_callbacks.vader
@@ -0,0 +1,55 @@
+Before:
+ Save g:ale_c_parse_makefile
+ Save g:ale_history_enabled
+
+ let g:ale_c_parse_makefile = 0
+ let g:ale_history_enabled = 0
+
+ let g:get_cflags_return_value = ''
+ let g:executable_map = {}
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
+ function! ale#engine#IsExecutable(buffer, executable) abort
+ return has_key(g:executable_map, a:executable)
+ endfunction
+
+ function! ale#c#GetCFlags(buffer, output) abort
+ return g:get_cflags_return_value
+ endfunction
+
+ call ale#assert#SetUpLinterTest('c', 'cc')
+
+ let b:command_tail = ' -S -x c'
+ \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
+ \ . ' -iquote ' . ale#Escape(getcwd())
+ \ . ' -std=c11 -Wall -'
+
+After:
+ unlet! g:get_cflags_return_value
+ unlet! g:executable_map
+ unlet! b:command_tail
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(clang should be used instead of gcc, if available):
+ let g:executable_map = {'clang': 1}
+
+ AssertLinter 'clang', [ale#Escape('clang') . b:command_tail]
+
+Execute(The executable should be configurable):
+ AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
+
+ let b:ale_c_cc_executable = 'foobar'
+
+ AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
+
+Execute(The -std flag should be replaced by parsed C flags):
+ let b:command_tail = substitute(b:command_tail, 'c11', 'c99 ', '')
+ let g:get_cflags_return_value = '-std=c99'
+
+ AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
diff --git a/test/command_callback/test_c_clang_command_callbacks.vader b/test/command_callback/test_c_clang_command_callbacks.vader
deleted file mode 100644
index b8c02e4d..00000000
--- a/test/command_callback/test_c_clang_command_callbacks.vader
+++ /dev/null
@@ -1,20 +0,0 @@
-Before:
- Save g:ale_c_parse_makefile
- let g:ale_c_parse_makefile = 0
-
- call ale#assert#SetUpLinterTest('c', 'clang')
- let b:command_tail = ' -S -x c -fsyntax-only -iquote'
- \ . ' ' . ale#Escape(getcwd())
- \ . ' -std=c11 -Wall -'
-
-After:
- unlet! b:command_tail
-
- call ale#assert#TearDownLinterTest()
-
-Execute(The executable should be configurable):
- AssertLinter 'clang', [ale#Escape('clang') . b:command_tail]
-
- let b:ale_c_clang_executable = 'foobar'
-
- AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
diff --git a/test/command_callback/test_c_gcc_command_callbacks.vader b/test/command_callback/test_c_gcc_command_callbacks.vader
deleted file mode 100644
index 2dbb8b7c..00000000
--- a/test/command_callback/test_c_gcc_command_callbacks.vader
+++ /dev/null
@@ -1,22 +0,0 @@
-Before:
- Save g:ale_c_parse_makefile
- let g:ale_c_parse_makefile = 0
-
- call ale#assert#SetUpLinterTest('c', 'gcc')
-
- let b:command_tail = ' -S -x c'
- \ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
- \ . ' -iquote ' . ale#Escape(getcwd())
- \ . ' -std=c11 -Wall -'
-
-After:
- call ale#assert#TearDownLinterTest()
-
- unlet! b:command_tail
-
-Execute(The executable should be configurable):
- AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
-
- let b:ale_c_gcc_executable = 'foobar'
-
- AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader
index e6102998..8384a659 100644
--- a/test/command_callback/test_c_import_paths.vader
+++ b/test/command_callback/test_c_import_paths.vader
@@ -7,6 +7,7 @@ Before:
Save g:__ale_c_project_filenames
let g:original_project_filenames = g:__ale_c_project_filenames
+ let g:executable_map = {}
" Remove the .git/HEAD dir for C import paths for these tests.
" The tests run inside of a git repo.
@@ -18,17 +19,26 @@ Before:
let g:ale_c_parse_compile_commands = 0
let g:ale_c_parse_makefile = 0
+ runtime autoload/ale/engine.vim
+
+ function! ale#engine#IsExecutable(buffer, executable) abort
+ return has_key(g:executable_map, a:executable)
+ endfunction
+
After:
Restore
unlet! g:original_project_filenames
+ unlet! g:executable_map
+
+ runtime autoload/ale/engine.vim
call ale#assert#TearDownLinterTest()
-Execute(The C GCC handler should include 'include' directories for projects with a Makefile):
- call ale#assert#SetUpLinterTest('c', 'gcc')
+Execute(The C cc linter should include 'include' directories for projects with a Makefile):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -37,10 +47,10 @@ Execute(The C GCC handler should include 'include' directories for projects with
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
\ . ' -'
-Execute(The C GCC handler should include 'include' directories for projects with a configure file):
- call ale#assert#SetUpLinterTest('c', 'gcc')
+Execute(The C cc linter should include 'include' directories for projects with a configure file):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -49,10 +59,10 @@ Execute(The C GCC handler should include 'include' directories for projects with
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
\ . ' -'
-Execute(The C GCC handler should include root directories for projects with .h files in them):
- call ale#assert#SetUpLinterTest('c', 'gcc')
+Execute(The C cc linter should include root directories for projects with .h files in them):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -61,10 +71,10 @@ Execute(The C GCC handler should include root directories for projects with .h f
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
\ . ' -'
-Execute(The C GCC handler should include root directories for projects with .hpp files in them):
- call ale#assert#SetUpLinterTest('c', 'gcc')
+Execute(The C cc linter should include root directories for projects with .hpp files in them):
+ call ale#assert#SetUpLinterTest('c', 'cc')
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.c')
- let g:ale_c_gcc_options = ''
+ let g:ale_c_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -73,54 +83,6 @@ Execute(The C GCC handler should include root directories for projects with .hpp
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
\ . ' -'
-Execute(The C Clang handler should include 'include' directories for projects with a Makefile):
- call ale#assert#SetUpLinterTest('c', 'clang')
- call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.c')
- let g:ale_c_clang_options = ''
-
- AssertLinter 'clang',
- \ ale#Escape('clang')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
- \ . ' -'
-
-Execute(The C Clang handler should include 'include' directories for projects with a configure file):
- call ale#assert#SetUpLinterTest('c', 'clang')
- call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
- let g:ale_c_clang_options = ''
-
- AssertLinter 'clang',
- \ ale#Escape('clang')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
- \ . ' -'
-
-Execute(The C Clang handler should include root directories for projects with .h files in them):
- call ale#assert#SetUpLinterTest('c', 'clang')
- call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.c')
- let g:ale_c_clang_options = ''
-
- AssertLinter 'clang',
- \ ale#Escape('clang')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
- \ . ' -'
-
-Execute(The C Clang handler should include root directories for projects with .hpp files in them):
- call ale#assert#SetUpLinterTest('c', 'clang')
- call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.c')
- let g:ale_c_clang_options = ''
-
- AssertLinter 'clang',
- \ ale#Escape('clang')
- \ . ' -S -x c -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
- \ . ' -'
-
Execute(The C ClangTidy handler should include 'include' directories for projects with a Makefile):
call ale#assert#SetUpLinterTest('c', 'clangtidy')
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
@@ -131,10 +93,10 @@ Execute(The C ClangTidy handler should include 'include' directories for project
\ . ' %s '
\ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
-Execute(The C++ GCC handler should include 'include' directories for projects with a Makefile):
- call ale#assert#SetUpLinterTest('cpp', 'gcc')
+Execute(The C++ cc linter should include 'include' directories for projects with a Makefile):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -143,10 +105,10 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
\ . ' -'
-Execute(The C++ GCC handler should include 'include' directories for projects with a configure file):
- call ale#assert#SetUpLinterTest('cpp', 'gcc')
+Execute(The C++ cc linter should include 'include' directories for projects with a configure file):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -155,10 +117,10 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
\ . ' -'
-Execute(The C++ GCC handler should include root directories for projects with .h files in them):
- call ale#assert#SetUpLinterTest('cpp', 'gcc')
+Execute(The C++ cc linter should include root directories for projects with .h files in them):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -167,10 +129,10 @@ Execute(The C++ GCC handler should include root directories for projects with .h
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
\ . ' -'
-Execute(The C++ GCC handler should include root directories for projects with .hpp files in them):
- call ale#assert#SetUpLinterTest('cpp', 'gcc')
+Execute(The C++ cc linter should include root directories for projects with .hpp files in them):
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.cpp')
- let g:ale_cpp_gcc_options = ''
+ let g:ale_cpp_cc_options = ''
AssertLinter 'gcc',
\ ale#Escape('gcc')
@@ -179,54 +141,6 @@ Execute(The C++ GCC handler should include root directories for projects with .h
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
\ . ' -'
-Execute(The C++ Clang handler should include 'include' directories for projects with a Makefile):
- call ale#assert#SetUpLinterTest('cpp', 'clang')
- call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
- let g:ale_cpp_clang_options = ''
-
- AssertLinter 'clang++',
- \ ale#Escape('clang++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
- \ . ' -'
-
-Execute(The C++ Clang handler should include 'include' directories for projects with a configure file):
- call ale#assert#SetUpLinterTest('cpp', 'clang')
- call ale#test#SetFilename('../test_c_projects/configure_project/subdir/file.cpp')
- let g:ale_cpp_clang_options = ''
-
- AssertLinter 'clang++',
- \ ale#Escape('clang++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
- \ . ' -'
-
-Execute(The C++ Clang handler should include root directories for projects with .h files in them):
- call ale#assert#SetUpLinterTest('cpp', 'clang')
- call ale#test#SetFilename('../test_c_projects/h_file_project/subdir/file.cpp')
- let g:ale_cpp_clang_options = ''
-
- AssertLinter 'clang++',
- \ ale#Escape('clang++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
- \ . ' -'
-
-Execute(The C++ Clang handler should include root directories for projects with .hpp files in them):
- call ale#assert#SetUpLinterTest('cpp', 'clang')
- call ale#test#SetFilename('../test_c_projects/hpp_file_project/subdir/file.cpp')
- let g:ale_cpp_clang_options = ''
-
- AssertLinter 'clang++',
- \ ale#Escape('clang++')
- \ . ' -S -x c++ -fsyntax-only'
- \ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
- \ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
- \ . ' -'
-
Execute(The C++ ClangTidy handler should include json folders for projects with suitable build directory in them):
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
call ale#test#SetFilename('../test_c_projects/json_project/subdir/file.cpp')
diff --git a/test/command_callback/test_cpp_clang_command_callbacks.vader b/test/command_callback/test_cpp_clang_command_callbacks.vader
deleted file mode 100644
index e96fd8e7..00000000
--- a/test/command_callback/test_cpp_clang_command_callbacks.vader
+++ /dev/null
@@ -1,19 +0,0 @@
-Before:
- Save g:ale_c_parse_makefile
- let g:ale_c_parse_makefile = 0
-
- call ale#assert#SetUpLinterTest('cpp', 'clang')
- let b:command_tail = ' -S -x c++ -fsyntax-only -iquote'
- \ . ' ' . ale#Escape(getcwd())
- \ . ' -std=c++14 -Wall -'
-
-After:
- unlet! b:command_tail
- call ale#assert#TearDownLinterTest()
-
-Execute(The executable should be configurable):
- AssertLinter 'clang++', ale#Escape('clang++') . b:command_tail
-
- let b:ale_cpp_clang_executable = 'foobar'
-
- AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
diff --git a/test/command_callback/test_cpp_gcc_command_callbacks.vader b/test/command_callback/test_cpp_gcc_command_callbacks.vader
index cfa4ecc0..930cc68a 100644
--- a/test/command_callback/test_cpp_gcc_command_callbacks.vader
+++ b/test/command_callback/test_cpp_gcc_command_callbacks.vader
@@ -1,20 +1,55 @@
Before:
Save g:ale_c_parse_makefile
+ Save g:ale_history_enabled
+
let g:ale_c_parse_makefile = 0
+ let g:ale_history_enabled = 0
+
+ let g:get_cflags_return_value = ''
+ let g:executable_map = {}
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
+ function! ale#engine#IsExecutable(buffer, executable) abort
+ return has_key(g:executable_map, a:executable)
+ endfunction
+
+ function! ale#c#GetCFlags(buffer, output) abort
+ return g:get_cflags_return_value
+ endfunction
+
+ call ale#assert#SetUpLinterTest('cpp', 'cc')
- call ale#assert#SetUpLinterTest('cpp', 'gcc')
let b:command_tail = ' -S -x c++'
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
\ . ' -iquote ' . ale#Escape(getcwd())
\ . ' -std=c++14 -Wall -'
After:
+ unlet! g:get_cflags_return_value
+ unlet! g:executable_map
unlet! b:command_tail
+
+ runtime autoload/ale/c.vim
+ runtime autoload/ale/engine.vim
+
call ale#assert#TearDownLinterTest()
+Execute(clang++ should be used instead of gcc, if available):
+ let g:executable_map = {'clang++': 1}
+
+ AssertLinter 'clang++', [ale#Escape('clang++') . b:command_tail]
+
Execute(The executable should be configurable):
- AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
+ AssertLinter 'gcc', [ale#Escape('gcc') . b:command_tail]
- let b:ale_cpp_gcc_executable = 'foobar'
+ let b:ale_cpp_cc_executable = 'foobar'
- AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
+ AssertLinter 'foobar', [ale#Escape('foobar') . b:command_tail]
+
+Execute(The -std flag should be replaced by parsed C flags):
+ let b:command_tail = substitute(b:command_tail, 'c++14', 'c++11 ', '')
+ let g:get_cflags_return_value = '-std=c++11'
+
+ AssertLinter 'gcc', ale#Escape('gcc') . b:command_tail
diff --git a/test/command_callback/test_elixir_credo.vader b/test/command_callback/test_elixir_credo.vader
index 1a146db8..3eb88846 100644
--- a/test/command_callback/test_elixir_credo.vader
+++ b/test/command_callback/test_elixir_credo.vader
@@ -8,6 +8,18 @@ After:
call ale#assert#TearDownLinterTest()
+Execute(Builds credo command with normal project):
+ 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 umbrella project):
+ call ale#test#SetFilename('elixir_paths/umbrella_project/apps/mix_project/lib/app.ex')
+
+ AssertLinter 'mix',
+ \ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/umbrella_project'))
+ \ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
+
Execute(Builds credo command with --strict mode when set to 1):
let g:ale_elixir_credo_strict = 1
diff --git a/test/command_callback/test_markdown_markdownlint_command_callback.vader b/test/command_callback/test_markdown_markdownlint_command_callback.vader
new file mode 100644
index 00000000..12766cfd
--- /dev/null
+++ b/test/command_callback/test_markdown_markdownlint_command_callback.vader
@@ -0,0 +1,13 @@
+Before:
+ call ale#assert#SetUpLinterTest('markdown', 'markdownlint')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' %s'
+
+Execute(The options should be configurable):
+ let g:ale_markdown_markdownlint_options = '--config ~/custom/.markdownlintrc'
+
+ AssertLinter 'markdownlint', ale#Escape('markdownlint') . ' --config ~/custom/.markdownlintrc %s'
diff --git a/test/command_callback/test_swift_swiftformat_command_callbacks.vader b/test/command_callback/test_swift_swiftformat_command_callbacks.vader
new file mode 100644
index 00000000..7be20bf7
--- /dev/null
+++ b/test/command_callback/test_swift_swiftformat_command_callbacks.vader
@@ -0,0 +1,25 @@
+Before:
+ call ale#assert#SetUpLinterTest('swift', 'swiftformat')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(Should use default command when not in a swift package):
+ call ale#test#SetFilename('../swift-test-files/non-swift-package-project/src/folder/dummy.swift')
+
+ AssertLinter 'swift-format',
+ \ ale#Escape('swift-format') . ' --mode lint %t'
+
+Execute(Should use swift run when in a swift package):
+ call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift')
+
+ AssertLinter 'swift',
+ \ ale#Escape('swift') . ' run swift-format --mode lint %t'
+
+Execute(Should let users configure a global executable and override local paths):
+ call ale#test#SetFilename('../swift-test-files/swift-package-project/src/folder/dummy.swift')
+
+ let g:ale_swift_swiftformat_executable = '/path/to/custom/swift-format'
+
+ AssertLinter '/path/to/custom/swift-format',
+ \ ale#Escape('/path/to/custom/swift-format') . ' --mode lint %t'