summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeffrey Lau <who.else.at.jlau.tk>2020-04-18 01:45:01 +0800
committerJeffrey Lau <who.else.at.jlau.tk>2020-04-21 02:29:22 +0800
commit60d683da3bfe3440cac4faa5072ecba4a1d2af98 (patch)
tree125bb0bc40f276f7be6e0497a61266d5c2ed04a0 /test
parentd2934ba017e01529f4b83b2995a62f884d30734f (diff)
downloadale-60d683da3bfe3440cac4faa5072ecba4a1d2af98.zip
Add vim-language-server linter support
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_vim_vimls.vader76
-rw-r--r--test/command_callback/vim_fixtures/invalid_vim_project/test.vim0
-rw-r--r--test/command_callback/vim_fixtures/node_modules/.bin/vim-language-server0
-rw-r--r--test/command_callback/vim_fixtures/path_with_autoload/autoload/test.vim0
-rw-r--r--test/command_callback/vim_fixtures/path_with_autoload/test.vim0
-rw-r--r--test/command_callback/vim_fixtures/path_with_initvim/init.vim0
-rw-r--r--test/command_callback/vim_fixtures/path_with_plugin/plugin/test.vim0
-rw-r--r--test/command_callback/vim_fixtures/path_with_plugin/test.vim0
-rw-r--r--test/command_callback/vim_fixtures/path_with_vimrc/.vimrc0
9 files changed, 76 insertions, 0 deletions
diff --git a/test/command_callback/test_vim_vimls.vader b/test/command_callback/test_vim_vimls.vader
new file mode 100644
index 00000000..ab12b637
--- /dev/null
+++ b/test/command_callback/test_vim_vimls.vader
@@ -0,0 +1,76 @@
+" Author: Jeffrey Lau https://github.com/zoonfafer
+" Description: Tests for the Vim vimls linter
+
+Before:
+ call ale#assert#SetUpLinterTest('vim', 'vimls')
+
+After:
+ if isdirectory(g:dir . '/.git')
+ call delete(g:dir . '/.git', 'd')
+ endif
+
+ call ale#assert#TearDownLinterTest()
+
+Execute(should set correct defaults):
+ AssertLinter 'vim-language-server', ale#Escape('vim-language-server') . ' --stdio'
+
+Execute(should set correct LSP values):
+ call ale#test#SetFilename('vim_fixtures/path_with_autoload/test.vim')
+ AssertLSPLanguage 'vim'
+ AssertLSPOptions {}
+ AssertLSPConfig {}
+ AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_autoload')
+
+Execute(should set correct project for .git/):
+ let b:parent_dir = ale#path#Simplify(g:dir . '/..')
+ let b:git_dir = b:parent_dir . '/.git'
+
+ call ale#test#SetFilename('vim_fixtures/test.vim')
+
+ if !isdirectory(b:git_dir)
+ call mkdir(b:git_dir)
+ endif
+
+ AssertLSPProject ale#path#Simplify(b:parent_dir)
+
+ call delete(b:git_dir, 'd')
+ unlet! b:git_dir
+
+Execute(should set correct project for plugin/):
+ call ale#test#SetFilename('vim_fixtures/path_with_plugin/test.vim')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_plugin')
+
+Execute(should accept configuration settings):
+ AssertLSPConfig {}
+
+ let b:ale_vim_vimls_config = {'vim': {'foobar': v:true}}
+ AssertLSPConfig {'vim': {'foobar': v:true}}
+
+Execute(should set correct project for .vimrc):
+ call ale#test#SetFilename('vim_fixtures/path_with_vimrc/.vimrc')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_vimrc')
+
+Execute(should set correct project for init.vim):
+ call ale#test#SetFilename('vim_fixtures/path_with_initvim/init.vim')
+
+ AssertLSPProject ale#path#Simplify(g:dir . '/vim_fixtures/path_with_initvim')
+
+Execute(should use the local executable when available):
+ call ale#test#SetFilename('vim_fixtures/file.vim')
+
+ AssertLinter ale#path#Simplify(g:dir . '/vim_fixtures/node_modules/.bin/vim-language-server'),
+ \ ale#Escape(ale#path#Simplify(g:dir . '/vim_fixtures/node_modules/.bin/vim-language-server')) . ' --stdio'
+
+Execute(should let the global executable to be used):
+ let g:ale_vim_vimls_use_global = 1
+ call ale#test#SetFilename('vim_fixtures/file.vim')
+
+ AssertLinter 'vim-language-server',
+ \ ale#Escape('vim-language-server') . ' --stdio'
+
+Execute(should let the executable to be configured):
+ let g:ale_vim_vimls_executable = 'foobar'
+
+ AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio'
diff --git a/test/command_callback/vim_fixtures/invalid_vim_project/test.vim b/test/command_callback/vim_fixtures/invalid_vim_project/test.vim
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/invalid_vim_project/test.vim
diff --git a/test/command_callback/vim_fixtures/node_modules/.bin/vim-language-server b/test/command_callback/vim_fixtures/node_modules/.bin/vim-language-server
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/node_modules/.bin/vim-language-server
diff --git a/test/command_callback/vim_fixtures/path_with_autoload/autoload/test.vim b/test/command_callback/vim_fixtures/path_with_autoload/autoload/test.vim
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/path_with_autoload/autoload/test.vim
diff --git a/test/command_callback/vim_fixtures/path_with_autoload/test.vim b/test/command_callback/vim_fixtures/path_with_autoload/test.vim
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/path_with_autoload/test.vim
diff --git a/test/command_callback/vim_fixtures/path_with_initvim/init.vim b/test/command_callback/vim_fixtures/path_with_initvim/init.vim
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/path_with_initvim/init.vim
diff --git a/test/command_callback/vim_fixtures/path_with_plugin/plugin/test.vim b/test/command_callback/vim_fixtures/path_with_plugin/plugin/test.vim
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/path_with_plugin/plugin/test.vim
diff --git a/test/command_callback/vim_fixtures/path_with_plugin/test.vim b/test/command_callback/vim_fixtures/path_with_plugin/test.vim
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/path_with_plugin/test.vim
diff --git a/test/command_callback/vim_fixtures/path_with_vimrc/.vimrc b/test/command_callback/vim_fixtures/path_with_vimrc/.vimrc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/vim_fixtures/path_with_vimrc/.vimrc