ale/test/command_callback/test_write_good_command_callback.vader
2018-07-06 22:46:36 +01:00

61 lines
1.9 KiB
Plaintext

Before:
call ale#assert#Init()
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
runtime ale_linters/markdown/write-good.vim
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()
call ale#linter#Reset()
Execute(The global executable should be used when the local one cannot be found):
AssertLinter
\ 'write-good',
\ ale#Escape('write-good') . ' %t',
Execute(The options should be used in the command):
let g:ale_writegood_options = '--foo --bar'
AssertLinter
\ 'write-good',
\ 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')
AssertLinter
\ 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'))
\ . ' %t',
Execute(Should use the node_modules/write-good executable, if available):
call ale#test#SetFilename('write-good-node-modules-2/test.txt')
AssertLinter
\ ale#path#Simplify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'),
\ (has('win32') ? 'node.exe ' : '')
\ . ale#Escape(ale#path#Simplify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'))
\ . ' %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
AssertLinter 'foo-bar', ale#Escape('foo-bar') . ' %t'