test: unit test for fecs fixer, fecs command
This commit is contained in:
parent
d4841cedf2
commit
4b6691f602
4 changed files with 34 additions and 0 deletions
0
test/command_callback/fecs_paths/fecs
Executable file
0
test/command_callback/fecs_paths/fecs
Executable file
0
test/command_callback/fecs_paths/fecs.exe
Executable file
0
test/command_callback/fecs_paths/fecs.exe
Executable file
8
test/command_callback/test_fecs_command_callback.vader
Normal file
8
test/command_callback/test_fecs_command_callback.vader
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpLinterTest('javascript', 'fecs')
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownLinterTest()
|
||||||
|
|
||||||
|
Execute(The default command should be correct):
|
||||||
|
AssertLinter 'fecs', ale#Escape('fecs') . ' check --colors=false --rule=true %t'
|
26
test/fixers/test_fecs_fixer_callback.vader
Normal file
26
test/fixers/test_fecs_fixer_callback.vader
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
Before:
|
||||||
|
call ale#assert#SetUpFixerTest('javascript', 'fecs')
|
||||||
|
runtime autoload/ale/handlers/fecs.vim
|
||||||
|
|
||||||
|
After:
|
||||||
|
call ale#assert#TearDownFixerTest()
|
||||||
|
|
||||||
|
Execute(The fecs fixer should respect to g:ale_javascript_fecs_executable):
|
||||||
|
let g:ale_javascript_fecs_executable = 'fecs_paths/fecs'
|
||||||
|
let g:ale_javascript_fecs_use_global = 1
|
||||||
|
silent cd ../command_callback
|
||||||
|
let g:dir = getcwd()
|
||||||
|
|
||||||
|
AssertEqual
|
||||||
|
\ {
|
||||||
|
\ 'command': ale#Escape(g:ale_javascript_fecs_executable) . ' format --replace=true %t',
|
||||||
|
\ 'read_temporary_file': 1,
|
||||||
|
\ },
|
||||||
|
\ ale#fixers#fecs#Fix(bufnr(''))
|
||||||
|
|
||||||
|
Execute(The fecs fixer should return 0 when executable not found):
|
||||||
|
let g:ale_javascript_fecs_executable = 'fecs-invalid'
|
||||||
|
let g:ale_javascript_fecs_use_global = 1
|
||||||
|
AssertEqual
|
||||||
|
\ 0,
|
||||||
|
\ ale#fixers#fecs#Fix(bufnr(''))
|
Reference in a new issue