diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lsp_settings.vimspec | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/lsp_settings.vimspec b/test/lsp_settings.vimspec index cff06a7..30995f6 100644 --- a/test/lsp_settings.vimspec +++ b/test/lsp_settings.vimspec @@ -52,4 +52,33 @@ Describe lsp_settings endtry End End + + Describe lsp_settings#exec_path + It should return full-path to the command + if has('win32') + Assert Equals(empty(lsp_settings#exec_path('cmd')), 0) + else + Assert Equals(empty(lsp_settings#exec_path('sh')), 0) + endif + End + + It should return 1 when command is executable in server/foo-bar/foo-bar + let l:servers_dir = lsp_settings#servers_dir() + + try + call delete(l:servers_dir . '/foo-bar', 'rf') + call mkdir(l:servers_dir . '/foo-bar', 'p') + if has('win32') + call writefile(['@echo off', 'echo foo-bar'], l:servers_dir . '/foo-bar/foo-bar.cmd') + Assert Equals(lsp_settings#exec_path('foo-bar'), l:servers_dir . '\foo-bar\foo-bar.cmd') + else + call writefile(['#!/bin/sh', 'echo foo-bar'], l:servers_dir . '/foo-bar/foo-bar') + call setfperm(l:servers_dir . '/foo-bar/foo-bar', 'rwxr-xr-x') + Assert Equals(lsp_settings#exec_path('foo-bar'), l:servers_dir . '/foo-bar/foo-bar') + endif + finally + call delete(l:servers_dir . '/foo-bar', 'rf') + endtry + End + End End |