blob: 279109e0140c4ec256f66e4c50a1a04130c0a913 (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
Before:
Save g:ale_javascript_standard_executable
Save g:ale_javascript_standard_use_global
Save g:ale_javascript_standard_options
unlet! b:executable
unlet! g:ale_javascript_standard_executable
unlet! b:ale_javascript_standard_executable
unlet! g:ale_javascript_standard_use_global
unlet! g:ale_javascript_standard_options
call ale#test#SetDirectory('/testplugin/test/command_callback')
call ale#test#SetFilename('testfile.js')
runtime ale_linters/javascript/standard.vim
After:
Restore
unlet! b:executable
call ale#test#SetFilename('test.txt')
call ale#test#RestoreDirectory()
call ale#linter#Reset()
Execute(bin/cmd.js paths should be preferred):
call ale#test#SetFilename('standard-test-files/with-cmd/testfile.js')
let b:executable = ale#path#Winify(
\ g:dir
\ . '/standard-test-files/with-cmd/node_modules/standard/bin/cmd.js'
\)
AssertEqual
\ b:executable,
\ ale_linters#javascript#standard#GetExecutable(bufnr(''))
AssertEqual
\ (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(b:executable)
\ . ' --stdin %s',
\ ale_linters#javascript#standard#GetCommand(bufnr(''))
Execute(.bin directories should be used too):
call ale#test#SetFilename('standard-test-files/with-bin/testfile.js')
let b:executable = ale#path#Winify(
\ g:dir
\ . '/standard-test-files/with-bin/node_modules/.bin/standard'
\)
AssertEqual
\ b:executable,
\ ale_linters#javascript#standard#GetExecutable(bufnr(''))
AssertEqual
\ ale#Escape(b:executable)
\ . ' --stdin %s',
\ ale_linters#javascript#standard#GetCommand(bufnr(''))
Execute(The global executable should be used otherwise):
AssertEqual
\ 'standard',
\ ale_linters#javascript#standard#GetExecutable(bufnr(''))
AssertEqual
\ ale#Escape('standard') . ' --stdin %s',
\ ale_linters#javascript#standard#GetCommand(bufnr(''))
Execute(The global executable should be configurable):
let b:ale_javascript_standard_executable = 'foobar'
AssertEqual
\ 'foobar',
\ ale_linters#javascript#standard#GetExecutable(bufnr(''))
AssertEqual
\ ale#Escape('foobar') . ' --stdin %s',
\ ale_linters#javascript#standard#GetCommand(bufnr(''))
Execute(The options should be configurable):
let b:ale_javascript_standard_options = '--wat'
AssertEqual
\ ale#Escape('standard') . ' --wat --stdin %s',
\ ale_linters#javascript#standard#GetCommand(bufnr(''))
|