Skip to content

Commit d176ca3

Browse files
dpellebrammool
authored andcommitted
patch 8.2.3421: a bit of code is not covered by tests
Problem: A bit of code is not covered by tests. Solution: Add a few more test cases. (Dominique Pellé, closes #8857)
1 parent 6b9efdd commit d176ca3

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

src/testdir/test_functions.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,7 @@ func Test_trim()
16211621
call assert_fails('eval trim(" vim ", " ", [])', 'E745:')
16221622
call assert_fails('eval trim(" vim ", " ", -1)', 'E475:')
16231623
call assert_fails('eval trim(" vim ", " ", 3)', 'E475:')
1624+
call assert_fails('eval trim(" vim ", 0)', 'E475:')
16241625

16251626
let chars = join(map(range(1, 0x20) + [0xa0], {n -> n->nr2char()}), '')
16261627
call assert_equal("x", trim(chars . "x" . chars))

src/testdir/test_history.vim

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ function Test_History()
9898
call assert_fails('call histdel(":", "\\%(")', 'E53:')
9999
endfunction
100100

101+
function Test_history_truncates_long_entry()
102+
" History entry short enough to fit on the screen should not be truncated.
103+
call histadd(':', 'echo x' .. repeat('y', &columns - 17) .. 'z')
104+
let a = execute('history : -1')
105+
106+
call assert_match("^\n # cmd history\n"
107+
\ .. "> *\\d\\+ echo x" .. repeat('y', &columns - 17) .. 'z$', a)
108+
109+
" Long history entry should be truncated to fit on the screen, with, '...'
110+
" inserted in the string to indicate the that there is truncation.
111+
call histadd(':', 'echo x' .. repeat('y', &columns - 16) .. 'z')
112+
let a = execute('history : -1')
113+
call assert_match("^\n # cmd history\n"
114+
\ .. "> *\\d\\+ echo xy\\+\.\.\.y\\+z$", a)
115+
endfunction
116+
101117
function Test_Search_history_window()
102118
new
103119
call setline(1, ['a', 'b', 'a', 'b'])

src/testdir/test_startup.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ func Test_invalid_args()
617617
call assert_equal('More info with: "vim -h"', out[2])
618618

619619
if has('quickfix')
620-
" Detect invalid repeated arguments '-t foo -t foo", '-q foo -q foo'.
620+
" Detect invalid repeated arguments '-t foo -t foo', '-q foo -q foo'.
621621
for opt in ['-t', '-q']
622622
let out = split(system(GetVimCommand() .. repeat(' ' .. opt .. ' foo', 2)), "\n")
623623
call assert_equal(1, v:shell_error)
@@ -863,7 +863,7 @@ func Test_t_arg()
863863
call writefile([' first', ' second', ' third'], 'Xfile1')
864864

865865
for t_arg in ['-t second', '-tsecond']
866-
if RunVim(before, after, '-t second')
866+
if RunVim(before, after, t_arg)
867867
call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'), t_arg)
868868
call delete('Xtestout')
869869
endif

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3421,
758760
/**/
759761
3420,
760762
/**/

0 commit comments

Comments
 (0)