]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/lsp/test_lsp_root_detection.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:

Merge commit '294584081929424aec883f90c7d6515b3743358d' as '.vim/bundle/vim-lsp-ale'
[etc/vim.git] / .vim / bundle / ale / test / lsp / test_lsp_root_detection.vader
1 Before:
2   Save g:ale_root
3   Save b:ale_root
4
5   let g:ale_root = {}
6
7   call ale#assert#SetUpLinterTest('c', 'clangd')
8
9   function! Hook1(buffer)
10     return 'abc123'
11   endfunction
12
13 After:
14   Restore
15
16   delfunction Hook1
17
18   call ale#assert#TearDownLinterTest()
19
20 Execute(The buffer-specific variable can be a string):
21   let b:ale_root = '/some/path'
22   call ale#test#SetFilename('other-file.c')
23
24   AssertLSPProject '/some/path'
25
26 Execute(The buffer-specific variable can be a dictionary):
27   let b:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'}
28   call ale#test#SetFilename('other-file.c')
29
30   AssertLSPProject '/some/path'
31
32 Execute(The buffer-specific variable can have funcrefs):
33   let b:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'}
34   call ale#test#SetFilename('other-file.c')
35
36   AssertLSPProject 'abc123'
37
38 Execute(The global variable can be a dictionary):
39   let g:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'}
40   call ale#test#SetFilename('other-file.c')
41
42   AssertLSPProject '/some/path'
43
44 Execute(The global variable can have funcrefs):
45   let g:ale_root = {'clangd': function('Hook1'), 'golangserver': '/path'}
46   call ale#test#SetFilename('other-file.c')
47
48   AssertLSPProject 'abc123'
49
50 Execute(The buffer-specific variable overrides the global variable):
51   let b:ale_root = {'clangd': '/some/path', 'golangserver': '/other/path'}
52   let g:ale_root = {'clangd': '/not/this/path', 'golangserver': '/elsewhere'}
53   call ale#test#SetFilename('other-file.c')
54
55   AssertLSPProject '/some/path'
56
57 Execute(The global variable is queried if the buffer-specific has no value):
58   let b:ale_root = {'golangserver': '/other/path'}
59   let g:ale_root = {'clangd': '/some/path', 'golangserver': '/elsewhere'}
60   call ale#test#SetFilename('other-file.c')
61
62   AssertLSPProject '/some/path'
63
64 Execute(No path should be returned by default):
65   call ale#test#SetFilename(tempname() . '/other-file.c')
66
67   AssertLSPProject ''