2017-11-12 01:06:28 +00:00
|
|
|
Before:
|
|
|
|
Save &filetype
|
|
|
|
Save g:ale_ocaml_ols_executable
|
|
|
|
Save g:ale_ocaml_ols_use_global
|
|
|
|
|
|
|
|
let &filetype = 'ocaml'
|
|
|
|
unlet! g:ale_ocaml_ols_executable
|
|
|
|
unlet! g:ale_ocaml_ols_use_global
|
|
|
|
|
|
|
|
runtime ale_linters/ocaml/ols.vim
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The language string should be correct):
|
|
|
|
AssertEqual 'ocaml', ale#handlers#ols#GetLanguage(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The default executable should be correct):
|
|
|
|
AssertEqual 'ocaml-language-server', ale#handlers#ols#GetExecutable(bufnr(''))
|
|
|
|
AssertEqual
|
|
|
|
\ ale#Escape('ocaml-language-server') . ' --stdio',
|
|
|
|
\ ale#handlers#ols#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The project root should be detected correctly):
|
|
|
|
AssertEqual '', ale#handlers#ols#GetProjectRoot(bufnr(''))
|
|
|
|
|
|
|
|
call ale#test#SetFilename('ols_paths/file.ml')
|
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 18:23:09 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/ols_paths'),
|
2017-11-12 01:06:28 +00:00
|
|
|
\ ale#handlers#ols#GetProjectRoot(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The local executable should be used when available):
|
|
|
|
call ale#test#SetFilename('ols_paths/file.ml')
|
|
|
|
|
|
|
|
AssertEqual
|
2017-12-19 18:23:09 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/ols_paths/node_modules/.bin/ocaml-language-server'),
|
2017-11-12 01:06:28 +00:00
|
|
|
\ ale#handlers#ols#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The gloabl executable should always be used when use_global is set):
|
|
|
|
let g:ale_ocaml_ols_use_global = 1
|
|
|
|
call ale#test#SetFilename('ols_paths/file.ml')
|
|
|
|
|
|
|
|
AssertEqual 'ocaml-language-server', ale#handlers#ols#GetExecutable(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The executable should be configurable):
|
|
|
|
let g:ale_ocaml_ols_executable = 'foobar'
|
|
|
|
|
|
|
|
AssertEqual 'foobar', ale#handlers#ols#GetExecutable(bufnr(''))
|