From 3212278c91bc70d39d1affd6fc86a19ff8cee832 Mon Sep 17 00:00:00 2001 From: Carlos Ramos Date: Sun, 22 Oct 2017 09:22:16 -0400 Subject: [PATCH] fix test's and delete unused code --- autoload/ale/fixers/mix_format.vim | 3 +-- autoload/ale/handlers/elixir.vim | 5 ----- test/fixers/test_elixir_fixer_callback.vader | 16 --------------- .../test_mix_format_fixer_callback.vader | 20 +++++++++++++++++++ 4 files changed, 21 insertions(+), 23 deletions(-) delete mode 100644 autoload/ale/handlers/elixir.vim delete mode 100644 test/fixers/test_elixir_fixer_callback.vader create mode 100644 test/fixers/test_mix_format_fixer_callback.vader diff --git a/autoload/ale/fixers/mix_format.vim b/autoload/ale/fixers/mix_format.vim index 905a6089..04866408 100644 --- a/autoload/ale/fixers/mix_format.vim +++ b/autoload/ale/fixers/mix_format.vim @@ -9,8 +9,7 @@ endfunction function! ale#fixers#mix_format#Fix(buffer) abort return { - \ 'command': ale#handlers#elixir#GetExecutable(a:buffer) - \ . ale#fixers#mix_format#GetExecutable(a:buffer) + \ 'command': ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer)) \ . ' format %t', \ 'read_temporary_file': 1, \} diff --git a/autoload/ale/handlers/elixir.vim b/autoload/ale/handlers/elixir.vim deleted file mode 100644 index be25d331..00000000 --- a/autoload/ale/handlers/elixir.vim +++ /dev/null @@ -1,5 +0,0 @@ -call ale#Set('elixir_executable', '') - -function! ale#handlers#elixir#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'elixir_executable') -endfunction diff --git a/test/fixers/test_elixir_fixer_callback.vader b/test/fixers/test_elixir_fixer_callback.vader deleted file mode 100644 index ff4786e7..00000000 --- a/test/fixers/test_elixir_fixer_callback.vader +++ /dev/null @@ -1,16 +0,0 @@ -Before: - call ale#test#SetDirectory('/testplugin/test/fixers') - -After: - call ale#test#RestoreDirectory() - -Execute(The executable path should be correct): - call ale#test#SetFilename('../elixir-test-files/testfile.ex') - - AssertEqual - \ { - \ 'read_temporary_file': 1, - \ 'command': 'mix format' - \ . ' %t', - \ }, - \ ale#fixers#elixir#Fix(bufnr('')) diff --git a/test/fixers/test_mix_format_fixer_callback.vader b/test/fixers/test_mix_format_fixer_callback.vader new file mode 100644 index 00000000..c6c97c57 --- /dev/null +++ b/test/fixers/test_mix_format_fixer_callback.vader @@ -0,0 +1,20 @@ +Before: + call ale#test#SetDirectory('/testplugin/test/fixers') + Save g:ale_elixir_mix_executable + + let g:ale_elixir_mix_executable = 'xxxinvalid' + +After: + call ale#test#RestoreDirectory() + +Execute(The mix_format callback should return the correct default values): + call ale#test#SetFilename('../elixir-test-files/testfile.ex') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Escape('xxxinvalid') + \ . ' format %t', + \ }, + \ ale#fixers#mix_format#Fix(bufnr('')) +