88 lines
2.4 KiB
Plaintext
88 lines
2.4 KiB
Plaintext
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(''))
|