comparison src/testdir/test_quickfix.vim @ 33650:5614c43616fe v9.0.2064

patch 9.0.2064: cannot use buffer-number for errorformat Commit: https://github.com/vim/vim/commit/b731800522af00fd348814d33a065b92e698afc3 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Wed Oct 25 20:50:28 2023 +0200 patch 9.0.2064: cannot use buffer-number for errorformat Problem: cannot use buffer-number for errorformat Solution: add support for parsing a buffer number using '%b' in 'errorformat' closes: #13419 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author Christian Brabandt <cb@256bit.org>
date Wed, 25 Oct 2023 21:00:04 +0200
parents 05188ca69e43
children 40c314f639cf
comparison
equal deleted inserted replaced
33649:88cad94caef9 33650:5614c43616fe
6445 copen 6445 copen
6446 call assert_equal(['filename|pattern| text'], getline(1, '$')) " The assert failed with Vim v9.0.0736; '| text' did not appear after the pattern. 6446 call assert_equal(['filename|pattern| text'], getline(1, '$')) " The assert failed with Vim v9.0.0736; '| text' did not appear after the pattern.
6447 call setqflist([], 'f') 6447 call setqflist([], 'f')
6448 endfunc 6448 endfunc
6449 6449
6450 " Test for "%b" in "errorformat"
6451 func Test_efm_format_b()
6452 call setqflist([], 'f')
6453 new
6454 call setline(1, ['1: abc', '1: def', '1: ghi'])
6455 let b1 = bufnr()
6456 new
6457 call setline(1, ['2: abc', '2: def', '2: ghi'])
6458 let b2 = bufnr()
6459 new
6460 call setline(1, ['3: abc', '3: def', '3: ghi'])
6461 let b3 = bufnr()
6462 new
6463 let lines =<< trim eval END
6464 {b1}:1:1
6465 {b2}:2:2
6466 {b3}:3:3
6467 END
6468 call setqflist([], ' ', #{lines: lines, efm: '%b:%l:%c'})
6469 cfirst
6470 call assert_equal([b1, 1, 1], [bufnr(), line('.'), col('.')])
6471 cnext
6472 call assert_equal([b2, 2, 2], [bufnr(), line('.'), col('.')])
6473 cnext
6474 call assert_equal([b3, 3, 3], [bufnr(), line('.'), col('.')])
6475 enew!
6476
6477 " Use a non-existing buffer
6478 let lines =<< trim eval END
6479 9991:1:1:m1
6480 9992:2:2:m2
6481 {b3}:3:3:m3
6482 END
6483 call setqflist([], ' ', #{lines: lines, efm: '%b:%l:%c:%m'})
6484 cfirst | cnext
6485 call assert_equal([b3, 3, 3], [bufnr(), line('.'), col('.')])
6486 " Lines with non-existing buffer numbers should be used as non-error lines
6487 call assert_equal([
6488 \ #{lnum: 0, bufnr: 0, end_lnum: 0, pattern: '', valid: 0, vcol: 0, nr: -1,
6489 \ module: '', type: '', end_col: 0, col: 0, text: '9991:1:1:m1'},
6490 \ #{lnum: 0, bufnr: 0, end_lnum: 0, pattern: '', valid: 0, vcol: 0, nr: -1,
6491 \ module: '', type: '', end_col: 0, col: 0, text: '9992:2:2:m2'},
6492 \ #{lnum: 3, bufnr: b3, end_lnum: 0, pattern: '', valid: 1, vcol: 0,
6493 \ nr: -1, module: '', type: '', end_col: 0, col: 3, text: 'm3'}],
6494 \ getqflist())
6495 %bw!
6496 call setqflist([], 'f')
6497 endfunc
6498
6450 " vim: shiftwidth=2 sts=2 expandtab 6499 " vim: shiftwidth=2 sts=2 expandtab