blob: ebcae0e7878ecb833919c91f6755ae07edb532c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
Before:
Save g:ale_php_langserver_executable
Save g:ale_php_langserver_config_path
Save g:ale_php_langserver_use_global
unlet! g:ale_php_langserver_executable
unlet! g:ale_php_langserver_config_path
unlet! g:ale_php_langserver_use_global
runtime ale_linters/php/langserver.vim
call ale#test#SetDirectory('/testplugin/test/command_callback')
After:
Restore
if isdirectory(g:dir . '/.git')
call delete(g:dir . '/.git', 'd')
endif
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(The default executable path should be correct):
AssertEqual
\ 'php-language-server.php',
\ ale_linters#php#langserver#GetExecutable(bufnr(''))
AssertEqual
\ 'php ' . ale#Escape('php-language-server.php'),
\ ale_linters#php#langserver#GetCommand(bufnr(''))
Execute(Vendor executables should be detected):
call ale#test#SetFilename('php-langserver-project/test.php')
AssertEqual
\ ale#path#Simplify(g:dir . '/php-langserver-project/vendor/bin/php-language-server.php'),
\ ale_linters#php#langserver#GetExecutable(bufnr(''))
AssertEqual
\ 'php ' . ale#Escape(ale#path#Simplify(
\ g:dir
\ . '/php-langserver-project/vendor/bin/php-language-server.php'
\ )),
\ ale_linters#php#langserver#GetCommand(bufnr(''))
Execute(The project path should be correct for .git directories):
call ale#test#SetFilename('php-langserver-project/test.php')
call mkdir(g:dir . '/.git')
AssertEqual g:dir, ale_linters#php#langserver#GetProjectRoot(bufnr(''))
|