summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-10-30 11:30:13 +0000
committerGitHub <noreply@github.com>2017-10-30 11:30:13 +0000
commit1575b3d7ddc5c2844d987f2abb0a5defe493972b (patch)
tree0fa6506730b54e319a45c7aa2a4eabe6811f950d /test
parentdaecbad543c68de1c0a2d8c368e4edde2f90461e (diff)
parent634eb1920cf6f22bf5a121928511ad873656b819 (diff)
downloadale-1575b3d7ddc5c2844d987f2abb0a5defe493972b.zip
Merge pull request #1059 from ahmedelgabri/reason-refmt
refmt fixer for ReasonML
Diffstat (limited to 'test')
-rw-r--r--test/fixers/test_refmt_fixer_callback.vader41
-rw-r--r--test/reasonml_files/testfile.re0
2 files changed, 41 insertions, 0 deletions
diff --git a/test/fixers/test_refmt_fixer_callback.vader b/test/fixers/test_refmt_fixer_callback.vader
new file mode 100644
index 00000000..9ec331e4
--- /dev/null
+++ b/test/fixers/test_refmt_fixer_callback.vader
@@ -0,0 +1,41 @@
+Before:
+ Save g:ale_reasonml_refmt_executable
+ Save g:ale_reasonml_refmt_options
+
+ " Use an invalid global executable, so we don't match it.
+ let g:ale_reasonml_refmt_executable = 'xxxinvalid'
+ let g:ale_reasonml_refmt_options = ''
+
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+
+Execute(The refmt callback should return the correct default values):
+ call ale#test#SetFilename('../reasonml_files/testfile.re')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' --in-place'
+ \ . ' %t',
+ \ },
+ \ ale#fixers#refmt#Fix(bufnr(''))
+
+Execute(The refmt callback should include custom refmt options):
+ let g:ale_reasonml_refmt_options = "-w 80"
+ call ale#test#SetFilename('../reasonml_files/testfile.re')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command': ale#Escape('xxxinvalid')
+ \ . ' ' . g:ale_reasonml_refmt_options
+ \ . ' --in-place'
+ \ . ' %t',
+ \ },
+ \ ale#fixers#refmt#Fix(bufnr(''))
+
diff --git a/test/reasonml_files/testfile.re b/test/reasonml_files/testfile.re
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/reasonml_files/testfile.re