]> git.madduck.net Git - etc/vim.git/blob - test/linter/test_vim_vimls.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / linter / test_vim_vimls.vader
1 " Author: Jeffrey Lau https://github.com/zoonfafer
2 " Description: Tests for the Vim vimls linter
3
4 Before:
5   call ale#assert#SetUpLinterTest('vim', 'vimls')
6
7 After:
8   if isdirectory(g:dir . '/.git')
9     call delete(g:dir . '/.git', 'd')
10   endif
11
12   call ale#assert#TearDownLinterTest()
13
14 Execute(should set correct defaults):
15   AssertLinter 'vim-language-server', ale#Escape('vim-language-server') . ' --stdio'
16
17 Execute(should set correct LSP values):
18   call ale#test#SetFilename('../test-files/vim/path_with_autoload/test.vim')
19   AssertLSPLanguage 'vim'
20   AssertLSPOptions {}
21   AssertLSPConfig {}
22   AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_autoload')
23
24 Execute(should set correct project for .git/):
25   let b:parent_dir = ale#path#Simplify(g:dir . '/..')
26   let b:git_dir = b:parent_dir . '/.git'
27
28   call ale#test#SetFilename('../test-files/vim/test.vim')
29
30   if !isdirectory(b:git_dir)
31     call mkdir(b:git_dir)
32   endif
33
34   AssertLSPProject ale#path#Simplify(b:parent_dir)
35
36   call delete(b:git_dir, 'd')
37   unlet! b:git_dir
38
39 Execute(should set correct project for plugin/):
40   call ale#test#SetFilename('../test-files/vim/path_with_plugin/test.vim')
41
42   AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_plugin')
43
44 Execute(should accept configuration settings):
45   AssertLSPConfig {}
46
47   let b:ale_vim_vimls_config = {'vim': {'foobar': v:true}}
48   AssertLSPConfig {'vim': {'foobar': v:true}}
49
50 Execute(should set correct project for .vimrc):
51   call ale#test#SetFilename('../test-files/vim/path_with_vimrc/.vimrc')
52
53   AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_vimrc')
54
55 Execute(should set correct project for init.vim):
56   call ale#test#SetFilename('../test-files/vim/path_with_initvim/init.vim')
57
58   AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/vim/path_with_initvim')
59
60 Execute(should use the local executable when available):
61   call ale#test#SetFilename('../test-files/vim/file.vim')
62
63   AssertLinter ale#path#Simplify(g:dir . '/../test-files/vim/node_modules/.bin/vim-language-server'),
64   \ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/vim/node_modules/.bin/vim-language-server')) . ' --stdio'
65
66 Execute(should let the global executable to be used):
67   let g:ale_vim_vimls_use_global = 1
68   call ale#test#SetFilename('../test-files/vim/file.vim')
69
70   AssertLinter 'vim-language-server',
71   \ ale#Escape('vim-language-server') . ' --stdio'
72
73 Execute(should allow the executable to be configured):
74   let g:ale_vim_vimls_executable = 'foobar'
75   call ale#test#SetFilename('../test-files/dummy')
76
77   AssertLinter 'foobar', ale#Escape('foobar') . ' --stdio'