aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-10-26 07:42:29 +0800
committerGitHub <noreply@github.com>2023-10-26 07:42:29 +0800
commitf2fc44550fbe5b7ebfedc2b155dc41e93f49aedb (patch)
tree6bad18b73d4f96c6b29d456c0269dcf1a6bc5533 /test
parentbfe8a39512bc4dbf4921c56158c61a172e8f10cf (diff)
downloadrneovim-f2fc44550fbe5b7ebfedc2b155dc41e93f49aedb.tar.gz
rneovim-f2fc44550fbe5b7ebfedc2b155dc41e93f49aedb.tar.bz2
rneovim-f2fc44550fbe5b7ebfedc2b155dc41e93f49aedb.zip
vim-patch:9.0.2064: cannot use buffer-number for errorformat (#25782)
Problem: cannot use buffer-number for errorformat Solution: add support for parsing a buffer number using '%b' in 'errorformat' closes: vim/vim#13419 https://github.com/vim/vim/commit/b731800522af00fd348814d33a065b92e698afc3 Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_quickfix.vim49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/old/testdir/test_quickfix.vim b/test/old/testdir/test_quickfix.vim
index ebf1bfdc64..b5abb08ed8 100644
--- a/test/old/testdir/test_quickfix.vim
+++ b/test/old/testdir/test_quickfix.vim
@@ -6320,4 +6320,53 @@ func Test_quickfix_buffer_contents()
call setqflist([], 'f')
endfunc
+" Test for "%b" in "errorformat"
+func Test_efm_format_b()
+ call setqflist([], 'f')
+ new
+ call setline(1, ['1: abc', '1: def', '1: ghi'])
+ let b1 = bufnr()
+ new
+ call setline(1, ['2: abc', '2: def', '2: ghi'])
+ let b2 = bufnr()
+ new
+ call setline(1, ['3: abc', '3: def', '3: ghi'])
+ let b3 = bufnr()
+ new
+ let lines =<< trim eval END
+ {b1}:1:1
+ {b2}:2:2
+ {b3}:3:3
+ END
+ call setqflist([], ' ', #{lines: lines, efm: '%b:%l:%c'})
+ cfirst
+ call assert_equal([b1, 1, 1], [bufnr(), line('.'), col('.')])
+ cnext
+ call assert_equal([b2, 2, 2], [bufnr(), line('.'), col('.')])
+ cnext
+ call assert_equal([b3, 3, 3], [bufnr(), line('.'), col('.')])
+ enew!
+
+ " Use a non-existing buffer
+ let lines =<< trim eval END
+ 9991:1:1:m1
+ 9992:2:2:m2
+ {b3}:3:3:m3
+ END
+ call setqflist([], ' ', #{lines: lines, efm: '%b:%l:%c:%m'})
+ cfirst | cnext
+ call assert_equal([b3, 3, 3], [bufnr(), line('.'), col('.')])
+ " Lines with non-existing buffer numbers should be used as non-error lines
+ call assert_equal([
+ \ #{lnum: 0, bufnr: 0, end_lnum: 0, pattern: '', valid: 0, vcol: 0, nr: -1,
+ \ module: '', type: '', end_col: 0, col: 0, text: '9991:1:1:m1'},
+ \ #{lnum: 0, bufnr: 0, end_lnum: 0, pattern: '', valid: 0, vcol: 0, nr: -1,
+ \ module: '', type: '', end_col: 0, col: 0, text: '9992:2:2:m2'},
+ \ #{lnum: 3, bufnr: b3, end_lnum: 0, pattern: '', valid: 1, vcol: 0,
+ \ nr: -1, module: '', type: '', end_col: 0, col: 3, text: 'm3'}],
+ \ getqflist())
+ %bw!
+ call setqflist([], 'f')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab