blob: 86e6f50724f55b2c9856e7b76aa18a095ae0d81b (
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
55
56
57
58
59
60
61
62
63
64
65
|
Before:
Save g:ale_writegood_options
Save g:ale_writegood_executable
Save g:ale_writegood_use_global
unlet! g:ale_writegood_options
unlet! g:ale_writegood_executable
unlet! g:ale_writegood_use_global
call ale#test#SetDirectory('/testplugin/test/command_callback')
call ale#test#SetFilename('testfile.txt')
call ale#handlers#writegood#ResetOptions()
After:
Restore
call ale#test#RestoreDirectory()
Execute(The global executable should be used when the local one cannot be found):
AssertEqual 'write-good', ale#handlers#writegood#GetExecutable(bufnr(''))
AssertEqual
\ ale#Escape('write-good') . ' %t',
\ ale#handlers#writegood#GetCommand(bufnr(''))
Execute(The options should be used in the command):
let g:ale_writegood_options = '--foo --bar'
AssertEqual
\ ale#Escape('write-good') . ' --foo --bar %t',
\ ale#handlers#writegood#GetCommand(bufnr(''))
Execute(Should use the node_modules/.bin executable, if available):
call ale#test#SetFilename('write-good-node-modules/test.txt')
AssertEqual
\ ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'),
\ ale#handlers#writegood#GetExecutable(bufnr(''))
AssertEqual
\ ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'))
\ . ' %t',
\ ale#handlers#writegood#GetCommand(bufnr(''))
Execute(Should use the node_modules/write-good executable, if available):
call ale#test#SetFilename('write-good-node-modules-2/test.txt')
AssertEqual
\ ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'),
\ ale#handlers#writegood#GetExecutable(bufnr(''))
AssertEqual
\ (has('win32') ? 'node' : '')
\ . ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'))
\ . ' %t',
\ ale#handlers#writegood#GetCommand(bufnr(''))
Execute(Should let users configure a global executable and override local paths):
call ale#test#SetFilename('write-good-node-modules-2/test.txt')
let g:ale_writegood_executable = 'foo-bar'
let g:ale_writegood_use_global = 1
AssertEqual 'foo-bar', ale#handlers#writegood#GetExecutable(bufnr(''))
AssertEqual
\ ale#Escape('foo-bar') . ' %t',
\ ale#handlers#writegood#GetCommand(bufnr(''))
|