diff options
author | Matthew Turland <tobias382@gmail.com> | 2017-07-17 14:28:21 -0500 |
---|---|---|
committer | w0rp <w0rp@users.noreply.github.com> | 2017-07-17 20:28:21 +0100 |
commit | da410caff8b2a7ba5c57e210ce24ac229ce347f0 (patch) | |
tree | 212057ac1202cb235489690d26b25e8094ec9d30 /test/command_callback | |
parent | a6cc492a996476f55a93c12d34c0547e5d9dd37f (diff) | |
download | ale-da410caff8b2a7ba5c57e210ce24ac229ce347f0.zip |
Add yaml swaglint linter (#771)
* Add yaml swaglint linter
Diffstat (limited to 'test/command_callback')
3 files changed, 36 insertions, 0 deletions
diff --git a/test/command_callback/swaglint_paths/docs/swagger.yaml b/test/command_callback/swaglint_paths/docs/swagger.yaml new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/swaglint_paths/docs/swagger.yaml diff --git a/test/command_callback/swaglint_paths/node_modules/.bin/swaglint b/test/command_callback/swaglint_paths/node_modules/.bin/swaglint new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/swaglint_paths/node_modules/.bin/swaglint diff --git a/test/command_callback/test_swaglint_command_callback.vader b/test/command_callback/test_swaglint_command_callback.vader new file mode 100644 index 00000000..5d04e923 --- /dev/null +++ b/test/command_callback/test_swaglint_command_callback.vader @@ -0,0 +1,36 @@ +Before: + runtime ale_linters/yaml/swaglint.vim + call ale#test#SetDirectory('/testplugin/test/command_callback') + +After: + call ale#linter#Reset() + let g:ale_yaml_swaglint_executable = 'swaglint' + let g:ale_yaml_swaglint_use_global = 0 + +Execute(The yaml swaglint command callback should return the correct default string): + AssertEqual 'swaglint', + \ ale_linters#yaml#swaglint#GetExecutable(bufnr('')) + AssertEqual 'swaglint -r compact --stdin', + \ ale_linters#yaml#swaglint#GetCommand(bufnr('')) + +Execute(The yaml swaglint command callback should be configurable): + let g:ale_yaml_swaglint_executable = '~/.local/bin/swaglint' + AssertEqual '~/.local/bin/swaglint', + \ ale_linters#yaml#swaglint#GetExecutable(bufnr('')) + AssertEqual '~/.local/bin/swaglint -r compact --stdin', + \ ale_linters#yaml#swaglint#GetCommand(bufnr('')) + +Execute(The yaml swaglint command callback should allow a global installation to be used): + let g:ale_yaml_swaglint_executable = '/usr/local/bin/swaglint' + let g:ale_yaml_swaglint_use_global = 1 + AssertEqual '/usr/local/bin/swaglint', + \ ale_linters#yaml#swaglint#GetExecutable(bufnr('')) + AssertEqual '/usr/local/bin/swaglint -r compact --stdin', + \ ale_linters#yaml#swaglint#GetCommand(bufnr('')) + +Execute(The yaml swaglint command callback should allow a local installation to be used): + call ale#test#SetFilename('swaglint_paths/docs/swagger.yaml') + AssertEqual g:dir . '/swaglint_paths/node_modules/.bin/swaglint', + \ ale_linters#yaml#swaglint#GetExecutable(bufnr('')) + AssertEqual g:dir . '/swaglint_paths/node_modules/.bin/swaglint -r compact --stdin', + \ ale_linters#yaml#swaglint#GetCommand(bufnr('')) |