blob: ffe403f4e78c13c99f2dddebde45b1b399356aca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
Before:
Save &filetype
Save g:ale_reason_ols_executable
Save g:ale_reason_ols_use_global
let &filetype = 'reason'
unlet! g:ale_reason_ols_executable
unlet! g:ale_reason_ols_use_global
runtime ale_linters/reason/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 'reason', 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.re')
AssertEqual
\ ale#path#Winify(g:dir . '/ols_paths'),
\ ale#handlers#ols#GetProjectRoot(bufnr(''))
Execute(The local executable should be used when available):
call ale#test#SetFilename('ols_paths/file.re')
AssertEqual
\ ale#path#Winify(g:dir . '/ols_paths/node_modules/.bin/ocaml-language-server'),
\ ale#handlers#ols#GetExecutable(bufnr(''))
Execute(The gloabl executable should always be used when use_global is set):
let g:ale_reason_ols_use_global = 1
call ale#test#SetFilename('ols_paths/file.re')
AssertEqual 'ocaml-language-server', ale#handlers#ols#GetExecutable(bufnr(''))
Execute(The executable should be configurable):
let g:ale_reason_ols_executable = 'foobar'
AssertEqual 'foobar', ale#handlers#ols#GetExecutable(bufnr(''))
|