summaryrefslogtreecommitdiff
path: root/test/fixers/test_luafmt_fixer_callback.vader
diff options
context:
space:
mode:
authorzandr <7629614+deathlyfrantic@users.noreply.github.com>2020-11-21 10:59:50 -0500
committerGitHub <noreply@github.com>2020-11-21 15:59:50 +0000
commite5d16caebe8a57074ee52d9bf0c0334fba4106a9 (patch)
tree280dc2ea2207e906976c00d53a9f8dc92d5a5f8c /test/fixers/test_luafmt_fixer_callback.vader
parent8e28de142affcc60b2b860603d299c44b43a4040 (diff)
downloadale-e5d16caebe8a57074ee52d9bf0c0334fba4106a9.zip
Add luafmt fixer (#3289)
Diffstat (limited to 'test/fixers/test_luafmt_fixer_callback.vader')
-rw-r--r--test/fixers/test_luafmt_fixer_callback.vader35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/fixers/test_luafmt_fixer_callback.vader b/test/fixers/test_luafmt_fixer_callback.vader
new file mode 100644
index 00000000..362da118
--- /dev/null
+++ b/test/fixers/test_luafmt_fixer_callback.vader
@@ -0,0 +1,35 @@
+Before:
+ Save g:ale_lua_luafmt_executable
+ Save g:ale_lua_luafmt_options
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_lua_luafmt_executable = 'xxxinvalid'
+ let g:ale_lua_luafmt_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The luafmt callback should return the correct default values):
+ call ale#test#SetFilename('../lua_files/testfile.lua')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('xxxinvalid') . ' --stdin',
+ \ },
+ \ ale#fixers#luafmt#Fix(bufnr(''))
+
+Execute(The luafmt callback should include custom luafmt options):
+ let g:ale_lua_luafmt_options = "--skip-children"
+ call ale#test#SetFilename('../lua_files/testfile.lua')
+
+ AssertEqual
+ \ {
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' ' . g:ale_lua_luafmt_options
+ \ . ' --stdin',
+ \ },
+ \ ale#fixers#luafmt#Fix(bufnr(''))