diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2022-10-13 11:59:22 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-10-13 11:59:22 +0100 |
commit | f8412c9d7cc487dacf47a217ae947da68a525c53 (patch) | |
tree | bba062ffddbdd37e7caedd586c3bc7ddbc92919e /src/testdir/test_quickfix.vim | |
parent | e42033e735febb163fdc57aadbc11787ca611ba9 (diff) | |
download | vim-git-f8412c9d7cc487dacf47a217ae947da68a525c53.tar.gz |
patch 9.0.0736: quickfix listing does not handle very long messagesv9.0.0736
Problem: Quickfix listing does not handle very long messages.
Solution: Use a growarray instead of a fixed size buffer. (Yegappan
Lakshmanan, closes #11357)
Diffstat (limited to 'src/testdir/test_quickfix.vim')
-rw-r--r-- | src/testdir/test_quickfix.vim | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/testdir/test_quickfix.vim b/src/testdir/test_quickfix.vim index 9e7986427..2ee754b39 100644 --- a/src/testdir/test_quickfix.vim +++ b/src/testdir/test_quickfix.vim @@ -6334,4 +6334,42 @@ func Test_loclist_replace_autocmd() call setloclist(0, [], 'f') endfunc +" Test for a very long error line and a very long information line +func Test_very_long_error_line() + let msg = repeat('abcdefghijklmn', 146) + let emsg = 'Xlonglines.c:1:' . msg + call writefile([msg, emsg], 'Xerror', 'D') + cfile Xerror + cwindow + call assert_equal($'|| {msg}', getline(1)) + call assert_equal($'Xlonglines.c|1| {msg}', getline(2)) + cclose + + let l = execute('clist!')->split("\n") + call assert_equal([$' 1: {msg}', $' 2 Xlonglines.c:1: {msg}'], l) + + let l = execute('cc')->split("\n") + call assert_equal([$'(2 of 2): {msg}'], l) + + call setqflist([], 'f') +endfunc + +" In the quickfix window, spaces at the beginning of an informational line +" should not be removed but should be removed from an error line. +func Test_info_line_with_space() + cexpr ["a.c:20:12: error: expected ';' before ':' token", + \ ' 20 | Afunc():', '', ' | ^'] + copen + call assert_equal(["a.c|20 col 12| error: expected ';' before ':' token", + \ '|| 20 | Afunc():', '|| ', + \ '|| | ^'], getline(1, '$')) + cclose + + let l = execute('clist!')->split("\n") + call assert_equal([" 1 a.c:20 col 12: error: expected ';' before ':' token", + \ ' 2: 20 | Afunc():', ' 3: ', ' 4: | ^'], l) + + call setqflist([], 'f') +endfunc + " vim: shiftwidth=2 sts=2 expandtab |