diff options
author | Sumner Evans <sumner.evans98@gmail.com> | 2017-10-25 00:27:40 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-10-25 00:28:06 +0100 |
commit | 7ac07a30b8c54dd44da403830d4ed84992d18656 (patch) | |
tree | 4a69129eb8f72370cbb62cbce7b75648b3ecafad /test/command_callback/test_write_good_command_callback.vader | |
parent | 1a5ef969a528c037b865828dedcd482a51d0e004 (diff) | |
download | ale-7ac07a30b8c54dd44da403830d4ed84992d18656.zip |
Fix #643 - Add support for write-good for many languages
Diffstat (limited to 'test/command_callback/test_write_good_command_callback.vader')
-rw-r--r-- | test/command_callback/test_write_good_command_callback.vader | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/test/command_callback/test_write_good_command_callback.vader b/test/command_callback/test_write_good_command_callback.vader new file mode 100644 index 00000000..86e6f507 --- /dev/null +++ b/test/command_callback/test_write_good_command_callback.vader @@ -0,0 +1,65 @@ +Before: + 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#SetDirectory('/testplugin/test/command_callback') + call ale#test#SetFilename('testfile.txt') + + call ale#handlers#writegood#ResetOptions() + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The global executable should be used when the local one cannot be found): + AssertEqual 'write-good', ale#handlers#writegood#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('write-good') . ' %t', + \ ale#handlers#writegood#GetCommand(bufnr('')) + +Execute(The options should be used in the command): + let g:ale_writegood_options = '--foo --bar' + + AssertEqual + \ ale#Escape('write-good') . ' --foo --bar %t', + \ ale#handlers#writegood#GetCommand(bufnr('')) + +Execute(Should use the node_modules/.bin executable, if available): + call ale#test#SetFilename('write-good-node-modules/test.txt') + + AssertEqual + \ ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good'), + \ ale#handlers#writegood#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules/node_modules/.bin/write-good')) + \ . ' %t', + \ ale#handlers#writegood#GetCommand(bufnr('')) + +Execute(Should use the node_modules/write-good executable, if available): + call ale#test#SetFilename('write-good-node-modules-2/test.txt') + + AssertEqual + \ ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js'), + \ ale#handlers#writegood#GetExecutable(bufnr('')) + AssertEqual + \ (has('win32') ? 'node' : '') + \ . ale#Escape(ale#path#Winify(g:dir . '/write-good-node-modules-2/node_modules/write-good/bin/write-good.js')) + \ . ' %t', + \ ale#handlers#writegood#GetCommand(bufnr('')) + +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 + + AssertEqual 'foo-bar', ale#handlers#writegood#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('foo-bar') . ' %t', + \ ale#handlers#writegood#GetCommand(bufnr('')) |