diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-03-05 17:30:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-05 17:30:04 +0800 |
commit | 836733dad8ca63a590eded1e3991444bac62b4b8 (patch) | |
tree | 9dfb719f4f96fb49f36b87f9d169988b660059e0 /src/nvim/testdir | |
parent | ed05d38d9fa643c7e562b754c6cfed8b9da5c4d8 (diff) | |
parent | e0bbe8ccf88d4ad0667ef38ae48d8bfdabb0cc26 (diff) | |
download | rneovim-836733dad8ca63a590eded1e3991444bac62b4b8.tar.gz rneovim-836733dad8ca63a590eded1e3991444bac62b4b8.tar.bz2 rneovim-836733dad8ca63a590eded1e3991444bac62b4b8.zip |
Merge pull request #22532 from zeertzjq/vim-9.0.0736
vim-patch:9.0.{0736,0749,0770,0870}: quickfix listing does not handle very long messages
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r-- | src/nvim/testdir/test_quickfix.vim | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_quickfix.vim b/src/nvim/testdir/test_quickfix.vim index 8dc4173d60..fedc486e62 100644 --- a/src/nvim/testdir/test_quickfix.vim +++ b/src/nvim/testdir/test_quickfix.vim @@ -6220,6 +6220,66 @@ 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 + +" The test depends on deferred delete and string interpolation, which haven't +" been ported, so override it with a rewrite that doesn't use these features. +func! Test_very_long_error_line() + let msg = repeat('abcdefghijklmn', 146) + let emsg = 'Xlonglines.c:1:' . msg + call writefile([msg, emsg], 'Xerror') + cfile Xerror + call delete('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 + func s:QfTf(_) endfunc |