summaryrefslogtreecommitdiff
path: root/test/command_callback/test_php_langserver_callbacks.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-15 18:24:53 +0100
committerw0rp <devw0rp@gmail.com>2018-07-15 18:28:28 +0100
commita42999a639b2916b769a85f37d037be314d9d61b (patch)
tree5ebfb4d357dc673efa93fd32a66b489c4510de40 /test/command_callback/test_php_langserver_callbacks.vader
parent5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff)
downloadale-a42999a639b2916b769a85f37d037be314d9d61b.zip
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'test/command_callback/test_php_langserver_callbacks.vader')
-rw-r--r--test/command_callback/test_php_langserver_callbacks.vader34
1 files changed, 7 insertions, 27 deletions
diff --git a/test/command_callback/test_php_langserver_callbacks.vader b/test/command_callback/test_php_langserver_callbacks.vader
index ebcae0e7..3b0a427e 100644
--- a/test/command_callback/test_php_langserver_callbacks.vader
+++ b/test/command_callback/test_php_langserver_callbacks.vader
@@ -1,49 +1,29 @@
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')
+ call ale#assert#SetUpLinterTest('php', 'langserver')
After:
- Restore
-
if isdirectory(g:dir . '/.git')
call delete(g:dir . '/.git', 'd')
endif
- call ale#test#RestoreDirectory()
- call ale#linter#Reset()
+ call ale#assert#TearDownLinterTest()
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(''))
+ AssertLinter 'php-language-server.php',
+ \ 'php ' . ale#Escape('php-language-server.php')
Execute(Vendor executables should be detected):
call ale#test#SetFilename('php-langserver-project/test.php')
- AssertEqual
+ AssertLinter
\ 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(''))
+ AssertLSPProject g:dir