ale/test/command_callback/test_cpp_cquery_command_cal...

49 lines
1.3 KiB
Plaintext

" Author: Ben Falconer <ben@falconers.me.uk>
" Description: A language server for C++
Before:
Save g:ale_cpp_cquery_executable
Save g:ale_cpp_cquery_cache_directory
unlet! g:ale_cpp_cquery_executable
unlet! b:ale_cpp_cquery_executable
unlet! g:ale_cpp_cquery_cache_directory
unlet! b:ale_cpp_cquery_cache_directory
runtime ale_linters/cpp/cquery.vim
After:
Restore
unlet! b:ale_cpp_cquery_executable
unlet! b:ale_cpp_cquery_cache_directory
call ale#linter#Reset()
Execute(The executable should be configurable):
AssertEqual 'cquery', ale_linters#cpp#cquery#GetExecutable(bufnr(''))
let b:ale_cpp_cquery_executable = 'foobar'
AssertEqual 'foobar', ale_linters#cpp#cquery#GetExecutable(bufnr(''))
Execute(The executable should be used in the command):
AssertEqual
\ ale#Escape('cquery'),
\ ale_linters#cpp#cquery#GetCommand(bufnr(''))
let b:ale_cpp_cquery_executable = 'foobar'
AssertEqual
\ ale#Escape('foobar'),
\ ale_linters#cpp#cquery#GetCommand(bufnr(''))
Execute(The cache directory should be configurable):
AssertEqual
\ {'cacheDirectory': expand('$HOME/.cache/cquery')},
\ ale_linters#cpp#cquery#GetInitializationOptions(bufnr(''))
let b:ale_cpp_cquery_cache_directory = '/foo/bar'
AssertEqual
\ {'cacheDirectory': '/foo/bar'},
\ ale_linters#cpp#cquery#GetInitializationOptions(bufnr(''))