2017-09-09 20:30:20 +00:00
|
|
|
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):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm')
|
2017-09-09 20:30:20 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/elm/node_modules/.bin/elm-format'))
|
2017-09-09 20:30:20 +00:00
|
|
|
\ . ' %t --yes',
|
|
|
|
\ },
|
2018-03-04 16:11:10 +00:00
|
|
|
\ ale#fixers#elm_format#Fix(bufnr(''))
|
2017-09-09 20:30:20 +00:00
|
|
|
|
|
|
|
Execute(The elm-format command should manage use_global = 1 param):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm')
|
2017-09-09 20:30:20 +00:00
|
|
|
let b:ale_elm_format_use_global = 1
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
|
|
|
\ ale#Escape('elm-format')
|
|
|
|
\ . ' %t --yes',
|
|
|
|
\ },
|
2018-03-04 16:11:10 +00:00
|
|
|
\ ale#fixers#elm_format#Fix(bufnr(''))
|
2017-09-09 20:30:20 +00:00
|
|
|
|
|
|
|
Execute(The elm-format command should manage executable param):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm')
|
2017-09-09 20:30:20 +00:00
|
|
|
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',
|
|
|
|
\ },
|
2018-03-04 16:11:10 +00:00
|
|
|
\ ale#fixers#elm_format#Fix(bufnr(''))
|
2017-09-09 20:30:20 +00:00
|
|
|
|
|
|
|
Execute(The elm-format command should manage empty options):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm')
|
2017-09-09 20:30:20 +00:00
|
|
|
let b:ale_elm_format_options = ''
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/elm/node_modules/.bin/elm-format'))
|
2017-09-09 20:30:20 +00:00
|
|
|
\ . ' %t',
|
|
|
|
\ },
|
2018-03-04 16:11:10 +00:00
|
|
|
\ ale#fixers#elm_format#Fix(bufnr(''))
|
2017-09-09 20:30:20 +00:00
|
|
|
|
|
|
|
Execute(The elm-format command should manage custom options):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/elm/src/subdir/testfile.elm')
|
2017-09-09 20:30:20 +00:00
|
|
|
let b:ale_elm_format_options = '--param1 --param2'
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'read_temporary_file': 1,
|
|
|
|
\ 'command':
|
2021-03-20 22:11:22 +00:00
|
|
|
\ ale#Escape(ale#path#Simplify(g:dir . '/../test-files/elm/node_modules/.bin/elm-format'))
|
2017-09-09 20:30:20 +00:00
|
|
|
\ . ' %t --param1 --param2',
|
|
|
|
\ },
|
2018-03-04 16:11:10 +00:00
|
|
|
\ ale#fixers#elm_format#Fix(bufnr(''))
|