diff options
author | D. Ben Knoble <ben.knoble+github@gmail.com> | 2020-11-30 13:42:21 -0500 |
---|---|---|
committer | D. Ben Knoble <ben.knoble+github@gmail.com> | 2020-11-30 13:42:21 -0500 |
commit | 7e12be0c643857221fb0772ffceba9ff4cd66cc9 (patch) | |
tree | 2db8c638bc9e8d1c68e1751a48888918e4bd9e4e /test/fixers/test_autoimport_fixer_callback.vader | |
parent | 47da7483d8d4bbbe4022b9c0821d3a7d2d0afaaf (diff) | |
parent | 03b6978a270107b670b0363d50f3eed4b365ba26 (diff) | |
download | ale-7e12be0c643857221fb0772ffceba9ff4cd66cc9.zip |
Merge remote-tracking branch 'origin/master' into fix-swipl
* origin/master: (40 commits)
fix: correct suggested filetype for yamlfix
feat: add yamlfix fixer
Use _config for LSP config options
Add support for R languageserver (#3370)
Fix 3103 - add shellcheck shell directive detection. (#3216)
Added the Vundle command in installation instructions (#3400)
Adds support for Tlint - A Tighten Opinionated PHP Linter (#3291)
Add php phpcbf options (#3383)
Use has('gui_running') instead of has('gui')
Close #2727 - Add a hover-only setting for balloons
Fix #3332 - Modify everything for rename/actions
Add a missing blank line in documentation
Add luafmt fixer (#3289)
#3442 Fix code fix clangd issue
Close #1466 - Add GVIM refactor menu support
Look for node packages in .yarn/sdks as well
Update documentation for code actions and rename
cmp forwards, and reverse the code actions
Support for LSP/tsserver Code Actions (#3437)
Move the test for buffer-local variables
...
Diffstat (limited to 'test/fixers/test_autoimport_fixer_callback.vader')
-rw-r--r-- | test/fixers/test_autoimport_fixer_callback.vader | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/fixers/test_autoimport_fixer_callback.vader b/test/fixers/test_autoimport_fixer_callback.vader new file mode 100644 index 00000000..6952cbb8 --- /dev/null +++ b/test/fixers/test_autoimport_fixer_callback.vader @@ -0,0 +1,50 @@ +Before: + Save g:ale_python_autoimport_executable + Save g:ale_python_autoimport_options + + " Use an invalid global executable, so we don't match it. + let g:ale_python_autoimport_executable = 'xxxinvalid' + let g:ale_python_autoimport_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + silent cd .. + silent cd command_callback + let g:dir = getcwd() + + let b:bin_dir = has('win32') ? 'Scripts' : 'bin' + +After: + Restore + + unlet! b:bin_dir + + call ale#test#RestoreDirectory() + +Execute(The autoimport callback should return the correct default values): + AssertEqual + \ 0, + \ ale#fixers#autoimport#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'command': ale#path#BufferCdString(bufnr('')) + \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autoimport')) . ' -', + \ }, + \ ale#fixers#autoimport#Fix(bufnr('')) + +Execute(The autoimport callback should respect custom options): + let g:ale_python_autoimport_options = '--multi-line=3 --trailing-comma' + + AssertEqual + \ 0, + \ ale#fixers#autoimport#Fix(bufnr('')) + + silent execute 'file ' . fnameescape(g:dir . '/python_paths/with_virtualenv/subdir/foo/bar.py') + AssertEqual + \ { + \ 'command': ale#path#BufferCdString(bufnr('')) + \ . ale#Escape(ale#path#Simplify(g:dir . '/python_paths/with_virtualenv/env/' . b:bin_dir . '/autoimport')) + \ . ' --multi-line=3 --trailing-comma -', + \ }, + \ ale#fixers#autoimport#Fix(bufnr('')) |