From ef182997b0e6793cc2517cc9fed0fe15c0ea5df0 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Thu, 30 Jan 2020 01:33:17 +0900 Subject: Add test --- test/lsp_settings.vimspec | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test') diff --git a/test/lsp_settings.vimspec b/test/lsp_settings.vimspec index 743f951..3b34941 100644 --- a/test/lsp_settings.vimspec +++ b/test/lsp_settings.vimspec @@ -11,4 +11,28 @@ Describe lsp_settings Assert Equals(lsp_settings#get('pyls', 'cmd', {key, name-> 'good'}), 'good') End End + + Describe lsp_settings#executable + It should return command is executable in $PATH + if has('win32') + Assert Equals(lsp_settings#executable('cmd'), 1) + else + Assert Equals(lsp_settings#executable('sh'), 1) + endif + Assert Equals(lsp_settings#executable('unknown-command'), 0) + End + + It should return command is executable in server/foo-bar/foo-bar + let l:servers_dir = fnamemodify(expand(':h:h').'/servers', ':p') + + try + call delete(l:servers_dir . '/foo-bar', 'rf') + call mkdir(l:servers_dir . '/foo-bar') + call writefile(['echo foo-bar'], l:servers_dir . '/foo-bar/foo-bar.cmd') + Assert Equals(lsp_settings#executable('foo-bar'), 1) + finally + call delete(l:servers_dir . '/foo-bar', 'rf') + endtry + End + End End -- cgit v1.2.3-54-g00ecf