summaryrefslogtreecommitdiff
path: root/test/fixers
diff options
context:
space:
mode:
authorSimon Bugert <sbugert@users.noreply.github.com>2017-11-05 22:24:41 +0100
committerw0rp <w0rp@users.noreply.github.com>2017-11-05 21:24:41 +0000
commit716b22d524b80941eee6538e988a963f923901f3 (patch)
tree280c4f532ea0b77d8fee1d702fe443fa81cf4f9c /test/fixers
parent7086586b1776d2b5f3bf87a7f0c25595a5d7e1b0 (diff)
downloadale-716b22d524b80941eee6538e988a963f923901f3.zip
Add shfmt fixer for sh files (#1083)
* Add shfmt fixer for sh files * Add tests for shfmt fixer
Diffstat (limited to 'test/fixers')
-rw-r--r--test/fixers/test_shfmt_fixer_callback.vader24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/fixers/test_shfmt_fixer_callback.vader b/test/fixers/test_shfmt_fixer_callback.vader
new file mode 100644
index 00000000..dcdf66b4
--- /dev/null
+++ b/test/fixers/test_shfmt_fixer_callback.vader
@@ -0,0 +1,24 @@
+Before:
+ Save g:ale_sh_shfmt_executable
+ Save g:ale_sh_shfmt_options
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_sh_shfmt_executable = 'xxxinvalid'
+ let g:ale_sh_shfmt_options = ''
+
+Execute(The shfmt callback should return the correct default values):
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('xxxinvalid'),
+ \ },
+ \ ale#fixers#shfmt#Fix(bufnr(''))
+
+Execute(The shfmt callback should include custom shfmt options):
+ let g:ale_sh_shfmt_options = '--some-option'
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape(g:ale_sh_shfmt_executable)
+ \ . ' --some-option',
+ \ },
+ \ ale#fixers#shfmt#Fix(bufnr(''))