2017-10-24 23:27:40 +00:00
|
|
|
Before:
|
2018-07-15 17:24:53 +00:00
|
|
|
" This is just one example of a language using the linter.
|
|
|
|
call ale#assert#SetUpLinterTest('markdown', 'writegood')
|
2018-07-06 21:46:36 +00:00
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
" The options are shared between many languages.
|
2017-10-24 23:27:40 +00:00
|
|
|
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#SetFilename('testfile.txt')
|
|
|
|
call ale#handlers#writegood#ResetOptions()
|
|
|
|
|
|
|
|
After:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2017-10-24 23:27:40 +00:00
|
|
|
|
|
|
|
Execute(The global executable should be used when the local one cannot be found):
|
2018-07-06 21:46:36 +00:00
|
|
|
AssertLinter
|
|
|
|
\ 'write-good',
|
2017-10-24 23:27:40 +00:00
|
|
|
\ ale#Escape('write-good') . ' %t',
|
|
|
|
|
|
|
|
Execute(The options should be used in the command):
|
|
|
|
let g:ale_writegood_options = '--foo --bar'
|
|
|
|
|
2018-07-06 21:46:36 +00:00
|
|
|
AssertLinter
|
|
|
|
\ 'write-good',
|
2017-10-24 23:27:40 +00:00
|
|
|
\ ale#Escape('write-good') . ' --foo --bar %t',
|
|
|
|
|
|
|
|
Execute(Should use the node_modules/.bin executable, if available):
|
|
|
|
call ale#test#SetFilename('write-good-node-modules/test.txt')
|
|
|
|
|
2018-07-06 21:46:36 +00:00
|
|
|
AssertLinter
|
2017-12-19 18:23:09 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'),
|
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'))
|
2017-10-24 23:27:40 +00:00
|
|
|
\ . ' %t',
|
|
|
|
|
|
|
|
Execute(Should use the node_modules/write-good executable, if available):
|
|
|
|
call ale#test#SetFilename('write-good-node-modules-2/test.txt')
|
|
|
|
|
2018-07-06 21:46:36 +00:00
|
|
|
AssertLinter
|
2017-12-19 18:23:09 +00:00
|
|
|
\ ale#path#Simplify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'),
|
2017-10-24 23:39:23 +00:00
|
|
|
\ (has('win32') ? 'node.exe ' : '')
|
2017-12-19 18:23:09 +00:00
|
|
|
\ . ale#Escape(ale#path#Simplify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'))
|
2017-10-24 23:27:40 +00:00
|
|
|
\ . ' %t',
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-07-06 21:46:36 +00:00
|
|
|
AssertLinter 'foo-bar', ale#Escape('foo-bar') . ' %t'
|