blob: c3e57f8b0bce637e2aa6a3df82d4a4ab72237713 (
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
|
Before:
Save g:ale_js_importjs_executable
" Use an invalid global executable, so we don't match it.
let g:ale_js_importjs_executable = 'xxxinvalid'
call ale#test#SetDirectory('/testplugin/test/fixers')
call ale#test#SetFilename('../javascript_files/test.js')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The importjs callback should return 0 when the executable isn't executable):
AssertEqual
\ 0,
\ ale#fixers#importjs#Fix(bufnr(''))
Execute(The importjs callback should run the command when the executable test passes):
let g:ale_js_importjs_executable = has('win32') ? 'cmd' : 'echo'
AssertEqual
\ {
\ 'process_with': 'ale#fixers#importjs#ProcessOutput',
\ 'command': ale#Escape(g:ale_js_importjs_executable) . ' fix %s'
\ },
\ ale#fixers#importjs#Fix(bufnr(''))
Execute(The ProcessOutput callback should return the expected output):
let g:testOutput = '{"messages":[],"fileContent":"one\ntwo","unresolvedImports":{}}'
AssertEqual
\ ['one', 'two'],
\ ale#fixers#importjs#ProcessOutput(bufnr(''), g:testOutput)
|