summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Pelle <dominique.pelle@gmail.com>2021-09-09 20:45:34 +0200
committerBram Moolenaar <Bram@vim.org>2021-09-09 20:45:34 +0200
commitd176ca3dde47c11aae0376c31b7e1ba0939c8c6c (patch)
tree5c76b8982fc809880de44d0584a26cb57c4820af
parent6b9efdde7828b3317b64f38bd90fb5a784a654c0 (diff)
patch 8.2.3421: a bit of code is not covered by testsv8.2.3421
Problem: A bit of code is not covered by tests. Solution: Add a few more test cases. (Dominique Pellé, closes #8857)
-rw-r--r--src/testdir/test_functions.vim1
-rw-r--r--src/testdir/test_history.vim16
-rw-r--r--src/testdir/test_startup.vim4
-rw-r--r--src/version.c2
4 files changed, 21 insertions, 2 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index c0b4259871..9a4b5975f5 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -1621,6 +1621,7 @@ func Test_trim()
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))
diff --git a/src/testdir/test_history.vim b/src/testdir/test_history.vim
index 1bea78d5a8..f1c31dee04 100644
--- a/src/testdir/test_history.vim
+++ b/src/testdir/test_history.vim
@@ -98,6 +98,22 @@ function Test_History()
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'])
diff --git a/src/testdir/test_startup.vim b/src/testdir/test_startup.vim
index 9872f0b4f5..6b64adf748 100644
--- a/src/testdir/test_startup.vim
+++ b/src/testdir/test_startup.vim
@@ -617,7 +617,7 @@ func Test_invalid_args()
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'.
+ " 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,7 +863,7 @@ func Test_t_arg()
call writefile([' first', ' second', ' third'], 'Xfile1')
for t_arg in ['-t second', '-tsecond']
- if RunVim(before, after, '-t second')
+ if RunVim(before, after, t_arg)
call assert_equal(['Xfile1:L2C5'], readfile('Xtestout'), t_arg)
call delete('Xtestout')
endif
diff --git a/src/version.c b/src/version.c
index 6d64ffed24..d1767f3497 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3421,
+/**/
3420,
/**/
3419,