From 48f68598cb49c5711f31d9ed204a4f0fdc390330 Mon Sep 17 00:00:00 2001 From: Alex Piechowski Date: Tue, 28 Dec 2021 04:23:57 -0700 Subject: Add auto-fixer for crystal (#4016) --- .../test_crystal_format_fixer_callback.vader | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/fixers/test_crystal_format_fixer_callback.vader (limited to 'test') diff --git a/test/fixers/test_crystal_format_fixer_callback.vader b/test/fixers/test_crystal_format_fixer_callback.vader new file mode 100644 index 00000000..d7d9588b --- /dev/null +++ b/test/fixers/test_crystal_format_fixer_callback.vader @@ -0,0 +1,33 @@ +Before: + Save g:ale_crystal_format_executable + Save g:ale_crystal_format_options + + " Use an invalid global executable, so we don't match it. + let g:ale_crystal_format_executable = 'xxxinvalid' + let g:ale_crystal_format_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The crystal format callback should return the correct default values): + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') . ' tool format -', + \ }, + \ ale#fixers#crystal#Fix(bufnr('')) + +Execute(The crystal format callback should include custom options): + let g:ale_crystal_format_options = "-list=true" + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' tool format ' . g:ale_crystal_format_options + \ . ' -', + \ }, + \ ale#fixers#crystal#Fix(bufnr('')) -- cgit v1.2.3