summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
Diffstat (limited to 'test/command_callback')
-rw-r--r--test/command_callback/clangd_paths/with_build_dir/unusual_build_dir_name/compile_commands.json (renamed from test/command_callback/clangd_paths/compile_commands.json)0
-rw-r--r--[-rwxr-xr-x]test/command_callback/clangd_paths/with_compile_commands/compile_commands.json (renamed from test/command_callback/psalm-project/vendor/bin/psalm-language-server)0
-rw-r--r--test/command_callback/ink_paths/story/main.ink0
-rwxr-xr-xtest/command_callback/psalm-project/vendor/bin/psalm0
-rw-r--r--test/command_callback/python_paths/with_virtualenv/subdir/foo/bar.pyi0
-rw-r--r--test/command_callback/test_c_clang_tidy_command_callback.vader3
-rw-r--r--test/command_callback/test_c_clangd_command_callbacks.vader31
-rw-r--r--test/command_callback/test_c_import_paths.vader21
-rw-r--r--test/command_callback/test_clang_tidy_command_callback.vader3
-rw-r--r--test/command_callback/test_ink_ls_command_callbacks.vader22
-rw-r--r--test/command_callback/test_languagetool_command_callback.vader9
-rw-r--r--test/command_callback/test_markdown_mdl_command_callback.vader6
-rw-r--r--test/command_callback/test_nimlsp_command_callback.vader12
-rw-r--r--test/command_callback/test_psalm_command_callbacks.vader10
-rw-r--r--test/command_callback/test_ruby_debride_command_callback.vader8
-rw-r--r--test/command_callback/test_scala_metals.vader20
-rw-r--r--test/command_callback/test_solc_command_callback.vader13
17 files changed, 144 insertions, 14 deletions
diff --git a/test/command_callback/clangd_paths/compile_commands.json b/test/command_callback/clangd_paths/with_build_dir/unusual_build_dir_name/compile_commands.json
index e69de29b..e69de29b 100644
--- a/test/command_callback/clangd_paths/compile_commands.json
+++ b/test/command_callback/clangd_paths/with_build_dir/unusual_build_dir_name/compile_commands.json
diff --git a/test/command_callback/psalm-project/vendor/bin/psalm-language-server b/test/command_callback/clangd_paths/with_compile_commands/compile_commands.json
index e69de29b..e69de29b 100755..100644
--- a/test/command_callback/psalm-project/vendor/bin/psalm-language-server
+++ b/test/command_callback/clangd_paths/with_compile_commands/compile_commands.json
diff --git a/test/command_callback/ink_paths/story/main.ink b/test/command_callback/ink_paths/story/main.ink
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/ink_paths/story/main.ink
diff --git a/test/command_callback/psalm-project/vendor/bin/psalm b/test/command_callback/psalm-project/vendor/bin/psalm
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/psalm-project/vendor/bin/psalm
diff --git a/test/command_callback/python_paths/with_virtualenv/subdir/foo/bar.pyi b/test/command_callback/python_paths/with_virtualenv/subdir/foo/bar.pyi
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/python_paths/with_virtualenv/subdir/foo/bar.pyi
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 fa76c66c..5ebbbd45 100644
--- a/test/command_callback/test_c_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_c_clang_tidy_command_callback.vader
@@ -1,4 +1,7 @@
Before:
+ Save g:ale_c_parse_makefile
+ let g:ale_c_parse_makefile = 0
+
call ale#assert#SetUpLinterTest('c', 'clangtidy')
call ale#test#SetFilename('test.c')
diff --git a/test/command_callback/test_c_clangd_command_callbacks.vader b/test/command_callback/test_c_clangd_command_callbacks.vader
index dc52097d..555122f6 100644
--- a/test/command_callback/test_c_clangd_command_callbacks.vader
+++ b/test/command_callback/test_c_clangd_command_callbacks.vader
@@ -4,31 +4,52 @@ Before:
Save &filetype
let &filetype = 'c'
+ Save b:ale_c_clangd_options
+ Save b:ale_c_build_dir
+ Save b:ale_c_build_dir_names
+ Save b:ale_c_parse_compile_commands
+
+ let b:command_tail = ' -x c'
+
After:
+ unlet! b:command_tail
+
call ale#assert#TearDownLinterTest()
Execute(The language string should be correct):
AssertLSPLanguage 'c'
Execute(The default executable should be correct):
- AssertLinter 'clangd', ale#Escape('clangd')
+ AssertLinter 'clangd', ale#Escape('clangd') . b:command_tail
Execute(The project root should be detected correctly):
call ale#test#SetFilename(tempname() . '/dummy.c')
AssertLSPProject ''
- call ale#test#SetFilename('clangd_paths/dummy.c')
+ call ale#test#SetFilename('clangd_paths/with_compile_commands/dummy.c')
- AssertLSPProject ale#path#Simplify(g:dir . '/clangd_paths')
+ AssertLSPProject ale#path#Simplify(g:dir . '/clangd_paths/with_compile_commands')
Execute(The executable should be configurable):
let g:ale_c_clangd_executable = 'foobar'
- AssertLinter 'foobar', ale#Escape('foobar')
+ AssertLinter 'foobar', ale#Escape('foobar') . b:command_tail
Execute(The options should be configurable):
let b:ale_c_clangd_options = '-compile-commands-dir=foo'
- AssertLinter 'clangd', ale#Escape('clangd') . ' ' . b:ale_c_clangd_options
+ AssertLinter 'clangd', ale#Escape('clangd') . b:command_tail . ' ' . b:ale_c_clangd_options
+
+Execute(The compile command database should be detected correctly):
+ call ale#test#SetFilename('clangd_paths/with_build_dir/dummy_src/dummy.c')
+
+ let b:ale_c_clangd_options = ''
+ let b:ale_c_build_dir = ''
+ let b:ale_c_build_dir_names = ['unusual_build_dir_name']
+ let b:ale_c_parse_compile_commands = 1
+
+ AssertLinter 'clangd', ale#Escape('clangd') . b:command_tail
+ \ . ' -compile-commands-dir='
+ \ . ale#Escape(ale#path#Simplify(g:dir . '/clangd_paths/with_build_dir/unusual_build_dir_name'))
diff --git a/test/command_callback/test_c_import_paths.vader b/test/command_callback/test_c_import_paths.vader
index 6c616d89..e6102998 100644
--- a/test/command_callback/test_c_import_paths.vader
+++ b/test/command_callback/test_c_import_paths.vader
@@ -121,6 +121,16 @@ Execute(The C Clang 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 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')
+ let g:ale_c_clangtidy_options = ''
+
+ AssertLinter 'clang-tidy',
+ \ ale#Escape('clang-tidy')
+ \ . ' %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')
call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
@@ -225,3 +235,14 @@ Execute(The C++ ClangTidy handler should include json folders for projects with
\ ale#Escape('clang-tidy')
\ . ' %s '
\ . '-p ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/json_project/build'))
+
+Execute(The C++ ClangTidy handler should include 'include' directories for projects with a Makefile):
+ call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
+ call ale#test#SetFilename('../test_c_projects/makefile_project/subdir/file.cpp')
+ let g:ale_cpp_clangtidy_options = ''
+
+ AssertLinter 'clang-tidy',
+ \ ale#Escape('clang-tidy')
+ \ . ' %s '
+ \ . '-- -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
+
diff --git a/test/command_callback/test_clang_tidy_command_callback.vader b/test/command_callback/test_clang_tidy_command_callback.vader
index 53ae311b..c2d18dea 100644
--- a/test/command_callback/test_clang_tidy_command_callback.vader
+++ b/test/command_callback/test_clang_tidy_command_callback.vader
@@ -1,4 +1,7 @@
Before:
+ Save g:ale_c_parse_makefile
+ let g:ale_c_parse_makefile = 0
+
call ale#assert#SetUpLinterTest('cpp', 'clangtidy')
call ale#test#SetFilename('test.cpp')
diff --git a/test/command_callback/test_ink_ls_command_callbacks.vader b/test/command_callback/test_ink_ls_command_callbacks.vader
new file mode 100644
index 00000000..5074506c
--- /dev/null
+++ b/test/command_callback/test_ink_ls_command_callbacks.vader
@@ -0,0 +1,22 @@
+Before:
+ call ale#assert#SetUpLinterTest('ink', 'ls')
+ set ft=ink
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(should set correct defaults):
+ AssertLinter 'ink-language-server', ale#Escape('ink-language-server') . ' --stdio'
+
+Execute(should set correct LSP values):
+ call ale#test#SetFilename('ink_paths/story/main.ink')
+
+ AssertLSPLanguage 'ink'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#path#Simplify(g:dir . '/ink_paths/story')
+
+Execute(should accept configuration settings):
+ AssertLSPConfig {}
+ let b:ale_ink_ls_initialization_options = {'ink': {'runThroughMono': v:true}}
+ AssertLSPOptions {'ink': {'runThroughMono': v:true}}
diff --git a/test/command_callback/test_languagetool_command_callback.vader b/test/command_callback/test_languagetool_command_callback.vader
index a79662b9..ff6b2064 100644
--- a/test/command_callback/test_languagetool_command_callback.vader
+++ b/test/command_callback/test_languagetool_command_callback.vader
@@ -12,4 +12,11 @@ Execute(Should be able to set a custom executable):
let g:ale_languagetool_executable = 'foobar'
AssertLinter 'foobar' , ale#Escape('foobar')
- \ . ' --autoDetect %s'
+ \ . ' --autoDetect %s'
+
+Execute(Should be able to include custom languagetool options):
+ let g:ale_languagetool_options = '--language en'
+
+ " is now 'foobar' based on above global
+ AssertLinter 'foobar', ale#Escape('foobar')
+ \ . ' --language en %s'
diff --git a/test/command_callback/test_markdown_mdl_command_callback.vader b/test/command_callback/test_markdown_mdl_command_callback.vader
index e029bf9b..1ce4db1a 100644
--- a/test/command_callback/test_markdown_mdl_command_callback.vader
+++ b/test/command_callback/test_markdown_mdl_command_callback.vader
@@ -5,15 +5,15 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
- AssertLinter 'mdl', ale#Escape('mdl')
+ AssertLinter 'mdl', ale#Escape('mdl') . ' -j'
Execute(The executable and options should be configurable):
let g:ale_markdown_mdl_executable = 'foo bar'
let g:ale_markdown_mdl_options = '--wat'
- AssertLinter 'foo bar', ale#Escape('foo bar') . ' --wat'
+ AssertLinter 'foo bar', ale#Escape('foo bar') . ' -j --wat'
Execute(Setting bundle appends 'exec mdl'):
let g:ale_markdown_mdl_executable = 'path to/bundle'
- AssertLinter 'path to/bundle', ale#Escape('path to/bundle') . ' exec mdl'
+ AssertLinter 'path to/bundle', ale#Escape('path to/bundle') . ' exec mdl -j'
diff --git a/test/command_callback/test_nimlsp_command_callback.vader b/test/command_callback/test_nimlsp_command_callback.vader
new file mode 100644
index 00000000..c109deef
--- /dev/null
+++ b/test/command_callback/test_nimlsp_command_callback.vader
@@ -0,0 +1,12 @@
+Before:
+ call ale#assert#SetUpLinterTest('nim', 'nimlsp')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(It does not set nim sources by default):
+ AssertLinter 'nimlsp', ale#Escape('nimlsp')
+
+Execute(Sets nimlsp and escapes sources from g:ale_nim_nimlsp_nim_sources):
+ let g:ale_nim_nimlsp_nim_sources = '/path/to /Nim'
+ AssertLinter 'nimlsp', ale#Escape('nimlsp') . ' ' . ale#Escape('/path/to /Nim')
diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader
index 33d770c2..74c68d43 100644
--- a/test/command_callback/test_psalm_command_callbacks.vader
+++ b/test/command_callback/test_psalm_command_callbacks.vader
@@ -9,18 +9,18 @@ After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
- AssertLinter 'psalm-language-server',
- \ ale#Escape('psalm-language-server')
+ AssertLinter 'psalm',
+ \ ale#Escape('psalm') . ' --language-server'
Execute(Vendor executables should be detected):
call ale#test#SetFilename('psalm-project/test.php')
AssertLinter
- \ ale#path#Simplify(g:dir . '/psalm-project/vendor/bin/psalm-language-server'),
+ \ ale#path#Simplify(g:dir . '/psalm-project/vendor/bin/psalm'),
\ ale#Escape(ale#path#Simplify(
\ g:dir
- \ . '/psalm-project/vendor/bin/psalm-language-server'
- \ ))
+ \ . '/psalm-project/vendor/bin/psalm'
+ \ )) . ' --language-server'
Execute(The project path should be correct for .git directories):
call ale#test#SetFilename('psalm-project/test.php')
diff --git a/test/command_callback/test_ruby_debride_command_callback.vader b/test/command_callback/test_ruby_debride_command_callback.vader
new file mode 100644
index 00000000..f7628432
--- /dev/null
+++ b/test/command_callback/test_ruby_debride_command_callback.vader
@@ -0,0 +1,8 @@
+Before:
+ call ale#assert#SetUpLinterTest('ruby', 'debride')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'debride', ale#Escape('debride') . ' %s'
diff --git a/test/command_callback/test_scala_metals.vader b/test/command_callback/test_scala_metals.vader
new file mode 100644
index 00000000..70e14c1a
--- /dev/null
+++ b/test/command_callback/test_scala_metals.vader
@@ -0,0 +1,20 @@
+" Author: Jeffrey Lau https://github.com/zoonfafer
+" Description: Tests for the Scala Metals linter
+
+Before:
+ call ale#assert#SetUpLinterTest('scala', 'metals')
+
+After:
+ call ale#assert#TearDownLinterTest()
+Execute(should set metals for sbt project with build.sbt):
+ call ale#test#SetFilename('../scala_fixtures/valid_sbt_project/Main.scala')
+ AssertLSPLanguage 'scala'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#path#Simplify(g:dir . 'command_callback/../scala_fixtures/valid_sbt_project')
+Execute(should not set metals for sbt project without build.sbt):
+ call ale#test#SetFilename('../scala_fixtures/invalid_sbt_project/Main.scala')
+ AssertLSPLanguage 'scala'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ''
diff --git a/test/command_callback/test_solc_command_callback.vader b/test/command_callback/test_solc_command_callback.vader
new file mode 100644
index 00000000..23521f6a
--- /dev/null
+++ b/test/command_callback/test_solc_command_callback.vader
@@ -0,0 +1,13 @@
+Before:
+ call ale#assert#SetUpLinterTest('solidity', 'solc')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct):
+ AssertLinter 'solc', 'solc %s'
+
+Execute(The options should be configurable):
+ let g:ale_solidity_solc_options = '--foobar'
+
+ AssertLinter 'solc', 'solc --foobar %s'