diff options
author | Jeff Willette <jrwillette88@gmail.com> | 2017-12-05 00:29:44 +0900 |
---|---|---|
committer | Jeff Willette <jrwillette88@gmail.com> | 2017-12-05 00:37:31 +0900 |
commit | fba3c57872de0ebf77586399405a25552298ad1b (patch) | |
tree | d2d70c10931d96631fdb1c1bba3559e644293dca /test/fixers | |
parent | 2f9869de44cf4b9542fc79a4c4566aa268910b23 (diff) | |
download | ale-fba3c57872de0ebf77586399405a25552298ad1b.zip |
added importjs fixer
- added tests for fixer functions
- added docs
Diffstat (limited to 'test/fixers')
-rw-r--r-- | test/fixers/test_importjs_fixer_callback.vader | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/fixers/test_importjs_fixer_callback.vader b/test/fixers/test_importjs_fixer_callback.vader new file mode 100644 index 00000000..c3e57f8b --- /dev/null +++ b/test/fixers/test_importjs_fixer_callback.vader @@ -0,0 +1,35 @@ +Before: + Save g:ale_js_importjs_executable + + " Use an invalid global executable, so we don't match it. + let g:ale_js_importjs_executable = 'xxxinvalid' + + call ale#test#SetDirectory('/testplugin/test/fixers') + call ale#test#SetFilename('../javascript_files/test.js') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The importjs callback should return 0 when the executable isn't executable): + AssertEqual + \ 0, + \ ale#fixers#importjs#Fix(bufnr('')) + +Execute(The importjs callback should run the command when the executable test passes): + let g:ale_js_importjs_executable = has('win32') ? 'cmd' : 'echo' + + AssertEqual + \ { + \ 'process_with': 'ale#fixers#importjs#ProcessOutput', + \ 'command': ale#Escape(g:ale_js_importjs_executable) . ' fix %s' + \ }, + \ ale#fixers#importjs#Fix(bufnr('')) + +Execute(The ProcessOutput callback should return the expected output): + let g:testOutput = '{"messages":[],"fileContent":"one\ntwo","unresolvedImports":{}}' + + AssertEqual + \ ['one', 'two'], + \ ale#fixers#importjs#ProcessOutput(bufnr(''), g:testOutput) |