Skip to content

Commit 260f7c2

Browse files
bhcleekarp242
authored andcommitted
fixup! improve test output handling
1 parent 79c5ac6 commit 260f7c2

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

autoload/go/test.vim

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,29 @@ function! s:parse_errors(lines) abort
266266

267267
let tokens = []
268268
if paniced
269+
" Matches lines in stacktraces produced by panic. The lines always have
270+
" one ore more leading tabs, followed by the path to the file. The file
271+
" path is followed by a colon and then the line number within the file
272+
" where the panic occurred. After that there's a space and hexadecimal
273+
" number.
274+
"
275+
" e.g.:
276+
" '\t/usr/local/go/src/time.go:1313 +0x5d'
269277
let tokens = matchlist(line, '^\t\+\(.\{-}\.go\):\(\d\+\) \(+0x.*\)')
270278
else
279+
" matches lines produced by `go test`. All lines produced by `go test`
280+
" that we're interested in start with zero or more spaces (increasing
281+
" depth of subtests is represented by a similar increase in the number
282+
" of spaces at the start of output lines. Top level tests start with
283+
" zero leading spaces). Lines that indicate test status (e.g. RUN, FAIL,
284+
" PASS) start after the spaces. Lines that indicate test failure
285+
" location or test log message location (e.g. "testing.T".Log) begin
286+
" with the appropriate number of spaces for the current test level,
287+
" followed by a tab, a filename , a colon, the line number, another
288+
" colon, a space, and the failure or log message.
289+
"
290+
" e.g.:
291+
" '\ttime_test.go:30: Likely problem: the time zone files have not been installed.'
271292
let tokens = matchlist(line, '^ *\t\+\(.\{-}\.go\):\(\d\+\):\s*\(.*\)')
272293
endif
273294

0 commit comments

Comments
 (0)