mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-30 08:04:31 +08:00
Fix #518 Fix handling of spaces in filenames for various linters
This commit is contained in:
44
test/handler/test_gobuild_handler.vader
Normal file
44
test/handler/test_gobuild_handler.vader
Normal file
@@ -0,0 +1,44 @@
|
||||
Before:
|
||||
runtime ale_linters/go/gobuild.vim
|
||||
|
||||
After:
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute (The gobuild handler should handle names with spaces):
|
||||
" We can't test Windows paths with the path resovling on Linux, but we can
|
||||
" test the regex.
|
||||
AssertEqual
|
||||
\ [
|
||||
\ [
|
||||
\ 'C:\something\file with spaces.go',
|
||||
\ '27',
|
||||
\ '',
|
||||
\ 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||
\ ],
|
||||
\ [
|
||||
\ 'C:\something\file with spaces.go',
|
||||
\ '5',
|
||||
\ '2',
|
||||
\ 'expected declaration, found ''STRING'' "log"',
|
||||
\ ],
|
||||
\ ],
|
||||
\ map(ale_linters#go#gobuild#GetMatches([
|
||||
\ 'C:\something\file with spaces.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||
\ 'C:\something\file with spaces.go:5:2: expected declaration, found ''STRING'' "log"',
|
||||
\ ]), 'v:val[1:4]')
|
||||
|
||||
Execute (The gobuild handler should handle relative paths correctly):
|
||||
:file! /foo/bar/baz.go
|
||||
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 27,
|
||||
\ 'col': 0,
|
||||
\ 'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||
\ 'type': 'E',
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#go#gobuild#Handler(42, [
|
||||
\ 'baz.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
|
||||
\ ])
|
||||
Reference in New Issue
Block a user