mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-01 00:53:29 +08:00
Fix 4740 - add hurlfmt linter (#4741)
* Fix 4740 - add hurlfmt linter * Fix 4740 - add hurlfmt fixer * Fix wrong comments * Add end_col to qflist * Fix test
This commit is contained in:
23
test/fixers/test_hurlfmt_fixer_callback.vader
Normal file
23
test/fixers/test_hurlfmt_fixer_callback.vader
Normal file
@@ -0,0 +1,23 @@
|
||||
Before:
|
||||
Save g:ale_hurl_hurlfmt_executable
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_hurl_hurlfmt_executable = 'xxxinvalid'
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The hurlfmt callback should return the correct default values):
|
||||
call ale#test#SetFilename('../test-files/hurl/dummy.hurl')
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'command': ale#Escape(g:ale_hurl_hurlfmt_executable)
|
||||
\ . ' --out hurl',
|
||||
\ },
|
||||
\ ale#fixers#hurlfmt#Fix(bufnr(''))
|
||||
|
||||
29
test/handler/test_hurlfmt_handler.vader
Normal file
29
test/handler/test_hurlfmt_handler.vader
Normal file
@@ -0,0 +1,29 @@
|
||||
Before:
|
||||
runtime ale_linters/hurl/hurlfmt.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The hurlfmt handler should parse lines correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 11,
|
||||
\ 'bufnr': 345,
|
||||
\ 'col': 48,
|
||||
\ 'end_col': 48,
|
||||
\ 'text': 'Parsing space : expecting a space ',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#hurl#hurlfmt#HandleOutput(345, [
|
||||
\ 'error: Parsing space',
|
||||
\ '--> test.hurl:11:48',
|
||||
\ ' |',
|
||||
\ '8 " | header "Content-Type"= "application/json; charset=utf-8"',
|
||||
\ ' | ^ expecting a space',
|
||||
\ ' |',
|
||||
\ ])
|
||||
|
||||
Execute(The rubocop handler should handle empty output):
|
||||
AssertEqual [], ale_linters#hurl#hurlfmt#HandleOutput(347, [])
|
||||
19
test/linter/test_hurlfmt.vader
Normal file
19
test/linter/test_hurlfmt.vader
Normal file
@@ -0,0 +1,19 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('hurl', 'hurlfmt')
|
||||
call ale#test#SetFilename('dummy.hurl')
|
||||
|
||||
let g:ale_ruby_hurlfmt_executable = 'hurlfmt'
|
||||
let g:ale_ruby_hurlfmt_options = ''
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(Executable should default to hurlfmt):
|
||||
AssertLinter 'hurlfmt', ale#Escape('hurlfmt')
|
||||
\ . ' --check --no-color '
|
||||
|
||||
Execute(Should be able to set a custom executable):
|
||||
let g:ale_hurl_hurlfmt_executable = 'bin/hurlfmt'
|
||||
|
||||
AssertLinter 'bin/hurlfmt' , ale#Escape('bin/hurlfmt')
|
||||
\ . ' --check --no-color '
|
||||
Reference in New Issue
Block a user