diff options
Diffstat (limited to 'test/fixers/test_ocamlformat_fixer_callback.vader')
-rw-r--r-- | test/fixers/test_ocamlformat_fixer_callback.vader | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/fixers/test_ocamlformat_fixer_callback.vader b/test/fixers/test_ocamlformat_fixer_callback.vader new file mode 100644 index 00000000..f0c36ed7 --- /dev/null +++ b/test/fixers/test_ocamlformat_fixer_callback.vader @@ -0,0 +1,38 @@ +Before: + Save g:ale_ocaml_ocamlformat_executable + Save g:ale_ocaml_ocamlformat_options + + " Use an invalid global executable, so we don't match it. + let g:ale_ocaml_ocamlformat_executable = 'xxxinvalid' + let g:ale_ocaml_ocamlformat_options = '' + + call ale#test#SetDirectory('/testplugin/test/fixers') + +After: + Restore + + call ale#test#RestoreDirectory() + +Execute(The ocamlformat callback should return the correct default values): + call ale#test#SetFilename('../ocaml-test-files/testfile.re') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' --name=' . ale#Escape(bufname(bufnr(''))) + \ . ' -', + \ }, + \ ale#fixers#ocamlformat#Fix(bufnr('')) + +Execute(The ocamlformat callback should include custom ocamlformat options): + let g:ale_ocaml_ocamlformat_options = "-m 78" + call ale#test#SetFilename('../ocaml-test-files/testfile.re') + + AssertEqual + \ { + \ 'command': ale#Escape('xxxinvalid') + \ . ' ' . g:ale_ocaml_ocamlformat_options + \ . ' --name=' . ale#Escape(bufname(bufnr(''))) + \ . ' -', + \ }, + \ ale#fixers#ocamlformat#Fix(bufnr('')) |