summaryrefslogtreecommitdiff
path: root/test/fixers/test_elm_format_fixer_callback.vader
diff options
context:
space:
mode:
authorClément DOUIN <clement.douin@gmail.com>2017-09-09 22:30:20 +0200
committerw0rp <w0rp@users.noreply.github.com>2017-09-09 21:30:20 +0100
commitf3da8f45c15fdd335593be060c0c6aaea751e81d (patch)
tree4c7f3161dfb816ae29e5befc9de5bd869e67aadd /test/fixers/test_elm_format_fixer_callback.vader
parentb3a9a0e3e8264cf8ce7c4d3780b06ab62d0db287 (diff)
downloadale-f3da8f45c15fdd335593be060c0c6aaea751e81d.zip
Add elm-format as a new fixer (#916)
* Add elm-format as a new fixer
Diffstat (limited to 'test/fixers/test_elm_format_fixer_callback.vader')
-rw-r--r--test/fixers/test_elm_format_fixer_callback.vader75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/fixers/test_elm_format_fixer_callback.vader b/test/fixers/test_elm_format_fixer_callback.vader
new file mode 100644
index 00000000..b8b9ed00
--- /dev/null
+++ b/test/fixers/test_elm_format_fixer_callback.vader
@@ -0,0 +1,75 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test/fixers')
+
+After:
+ unlet! b:ale_elm_format_executable
+ unlet! b:ale_elm_format_use_global
+ unlet! b:ale_elm_format_options
+
+ call ale#test#RestoreDirectory()
+
+Execute(The elm-format command should have default params):
+ call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command':
+ \ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
+ \ . ' %t --yes',
+ \ },
+ \ ale#fixers#format#Fix(bufnr(''))
+
+Execute(The elm-format command should manage use_global = 1 param):
+ call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
+ let b:ale_elm_format_use_global = 1
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command':
+ \ ale#Escape('elm-format')
+ \ . ' %t --yes',
+ \ },
+ \ ale#fixers#format#Fix(bufnr(''))
+
+Execute(The elm-format command should manage executable param):
+ call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
+ let b:ale_elm_format_use_global = 1
+ let b:ale_elm_format_executable = 'elmformat'
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command':
+ \ ale#Escape('elmformat')
+ \ . ' %t --yes',
+ \ },
+ \ ale#fixers#format#Fix(bufnr(''))
+
+Execute(The elm-format command should manage empty options):
+ call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
+ let b:ale_elm_format_options = ''
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command':
+ \ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
+ \ . ' %t',
+ \ },
+ \ ale#fixers#format#Fix(bufnr(''))
+
+Execute(The elm-format command should manage custom options):
+ call ale#test#SetFilename('../elm-test-files/src/subdir/testfile.elm')
+ let b:ale_elm_format_options = '--param1 --param2'
+
+ AssertEqual
+ \ {
+ \ 'read_temporary_file': 1,
+ \ 'command':
+ \ ale#Escape(simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
+ \ . ' %t --param1 --param2',
+ \ },
+ \ ale#fixers#format#Fix(bufnr(''))
+