To: vim_dev@googlegroups.com Subject: Patch 8.2.3421 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3421 Problem: A bit of code is not covered by tests. Solution: Add a few more test cases. (Dominique Pellé, closes #8857) Files: src/testdir/test_functions.vim, src/testdir/test_history.vim, src/testdir/test_startup.vim *** ../vim-8.2.3420/src/testdir/test_functions.vim 2021-07-31 17:20:00.620832958 +0200 --- src/testdir/test_functions.vim 2021-09-09 20:43:43.430556890 +0200 *************** *** 1621,1626 **** --- 1621,1627 ---- call assert_fails('eval trim(" vim ", " ", [])', 'E745:') call assert_fails('eval trim(" vim ", " ", -1)', 'E475:') call assert_fails('eval trim(" vim ", " ", 3)', 'E475:') + call assert_fails('eval trim(" vim ", 0)', 'E475:') let chars = join(map(range(1, 0x20) + [0xa0], {n -> n->nr2char()}), '') call assert_equal("x", trim(chars . "x" . chars)) *** ../vim-8.2.3420/src/testdir/test_history.vim 2020-09-23 22:38:01.503927513 +0200 --- src/testdir/test_history.vim 2021-09-09 20:43:43.430556890 +0200 *************** *** 98,103 **** --- 98,119 ---- call assert_fails('call histdel(":", "\\%(")', 'E53:') endfunction + function Test_history_truncates_long_entry() + " History entry short enough to fit on the screen should not be truncated. + call histadd(':', 'echo x' .. repeat('y', &columns - 17) .. 'z') + let a = execute('history : -1') + + call assert_match("^\n # cmd history\n" + \ .. "> *\\d\\+ echo x" .. repeat('y', &columns - 17) .. 'z$', a) + + " Long history entry should be truncated to fit on the screen, with, '...' + " inserted in the string to indicate the that there is truncation. + call histadd(':', 'echo x' .. repeat('y', &columns - 16) .. 'z') + let a = execute('history : -1') + call assert_match("^\n # cmd history\n" + \ .. "> *\\d\\+ echo xy\\+\.\.\.y\\+z$", a) + endfunction + function Test_Search_history_window() new call setline(1, ['a', 'b', 'a', 'b']) *** ../vim-8.2.3420/src/testdir/test_startup.vim 2021-06-27 22:09:56.032999658 +0200 --- src/testdir/test_startup.vim 2021-09-09 20:43:43.430556890 +0200 *************** *** 617,623 **** call assert_equal('More info with: "vim -h"', out[2]) if has('quickfix') ! " Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'. for opt in ['-t', '-q'] let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n") call assert_equal(1, v:shell_error) --- 617,623 ---- call assert_equal('More info with: "vim -h"', out[2]) if has('quickfix') ! " Detect invalid repeated arguments '-t foo -t foo', '-q foo -q foo'. for opt in ['-t', '-q'] let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n") call assert_equal(1, v:shell_error) *************** *** 863,869 **** call writefile([' first', ' second', ' third'], 'Xfile1') for t_arg in ['-t second', '-tsecond'] ! if RunVim(before, after, '-t second') call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'), t_arg) call delete('Xtestout') endif --- 863,869 ---- call writefile([' first', ' second', ' third'], 'Xfile1') for t_arg in ['-t second', '-tsecond'] ! if RunVim(before, after, t_arg) call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'), t_arg) call delete('Xtestout') endif *** ../vim-8.2.3420/src/version.c 2021-09-09 17:14:46.646989941 +0200 --- src/version.c 2021-09-09 20:44:15.334513461 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3421, /**/ -- hundred-and-one symptoms of being an internet addict: 17. You turn on your intercom when leaving the room so you can hear if new e-mail arrives. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///