/ test / handler / test_gobuild_handler.vader
test_gobuild_handler.vader
 1  Before:
 2    runtime ale_linters/go/gobuild.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute (The gobuild handler should handle names with spaces):
 8    " We can't test Windows paths with the path resovling on Linux, but we can
 9    " test the regex.
10    AssertEqual
11    \ [
12    \   [
13    \     'C:\something\file with spaces.go',
14    \     '27',
15    \     '',
16    \     'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
17    \   ],
18    \   [
19    \     'C:\something\file with spaces.go',
20    \     '5',
21    \     '2',
22    \     'expected declaration, found ''STRING'' "log"',
23    \   ],
24    \ ],
25    \ map(ale_linters#go#gobuild#GetMatches([
26    \   'C:\something\file with spaces.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
27    \   'C:\something\file with spaces.go:5:2: expected declaration, found ''STRING'' "log"',
28    \ ]), 'v:val[1:4]')
29  
30  Execute (The gobuild handler should handle relative paths correctly):
31    call ale#test#SetFilename('app/test.go')
32  
33    AssertEqual
34    \ [
35    \   {
36    \     'lnum': 27,
37    \     'col': 0,
38    \     'text': 'missing argument for Printf("%s"): format reads arg 2, have only 1 args',
39    \     'type': 'E',
40    \     'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
41    \   },
42    \ ],
43    \ ale_linters#go#gobuild#Handler(bufnr(''), [
44    \   'test.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args',
45    \ ])