summaryrefslogtreecommitdiff
path: root/test/command_callback
diff options
context:
space:
mode:
authorJerko Steiner <jerko.steiner@gmail.com>2019-10-22 16:40:27 -0500
committerJerko Steiner <jerko.steiner@gmail.com>2019-10-22 16:40:27 -0500
commit463deedc2998ecf864bb479f07e87aa4e83e3030 (patch)
tree34f72b8b639987de68050e9fa42ba1e2f0289f35 /test/command_callback
parent40890cfcf38a91e75176d39748a7e4ccb24aeb6b (diff)
parent67d0ccc398ca7650bb2c774a94d098bee3049169 (diff)
downloadale-463deedc2998ecf864bb479f07e87aa4e83e3030.zip
Merge branch 'master' into do-not-save-on-autoimport
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--test/command_callback/clangd_paths/with_compile_commands/compile_commands.json0
-rw-r--r--test/command_callback/test_c_clangd_command_callbacks.vader31
-rw-r--r--test/command_callback/test_nimlsp_command_callback.vader12
4 files changed, 38 insertions, 5 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/clangd_paths/with_compile_commands/compile_commands.json b/test/command_callback/clangd_paths/with_compile_commands/compile_commands.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/clangd_paths/with_compile_commands/compile_commands.json
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_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')