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)
diff --git a/src/testdir/test_history.vim b/src/testdir/test_history.vim
index 1bea78d..f1c31de 100644
--- a/src/testdir/test_history.vim
+++ b/src/testdir/test_history.vim
@@ -98,6 +98,22 @@
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'])