This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/fixers/test_elm_format_fixer_callback.vader
Gordon Fontenot 9258c73680
Fix elm-format fixer name
Support for elm-format as a fixer has existed since Sept 2017, but it's not
easy to discover because the fixer was named `format`. This breaks the
convention of the other fixers that use the full name in the registry.

I've gone ahead and fixed this discrepancy, but I left the existing registry
entry in place. We should move people towards using `elm-format` as the fixer
name, but I'd hate to break existing setups.
2018-03-08 09:19:12 -06:00

74 lines
2.1 KiB
Text

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(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --yes',
\ },
\ ale#fixers#elm_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#elm_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#elm_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(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t',
\ },
\ ale#fixers#elm_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(ale#path#Simplify(g:dir . '/../elm-test-files/node_modules/.bin/elm-format'))
\ . ' %t --param1 --param2',
\ },
\ ale#fixers#elm_format#Fix(bufnr(''))