aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-11-24 22:36:33 +0800
committerGitHub <noreply@github.com>2024-11-24 14:36:33 +0000
commit5c603064421b8829cf106c845902fcc41d3e31f2 (patch)
tree00c8d55c76c9ff447affb8d253ba6e6b9bd14d73 /test
parentef4f13d85c2612f8dd920f4290f607ec6fdb89cc (diff)
downloadrneovim-5c603064421b8829cf106c845902fcc41d3e31f2.tar.gz
rneovim-5c603064421b8829cf106c845902fcc41d3e31f2.tar.bz2
rneovim-5c603064421b8829cf106c845902fcc41d3e31f2.zip
vim-patch:9.1.0883: message history cleanup is missing some tests (#31331)
Problem: message history cleanup is missing some tests Solution: Add tests, refactor common code into did_set_msghistory() (Shougo Matsushita) closes: vim/vim#16078 https://github.com/vim/vim/commit/9f860a14c308f7a9a27a6850d36790615717a710 Co-authored-by: Shougo Matsushita <Shougo.Matsu@gmail.com> Co-authored-by: Milly <milly.ca@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_cmdline.vim26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim
index 290af4a4ca..6fa3ee5250 100644
--- a/test/old/testdir/test_cmdline.vim
+++ b/test/old/testdir/test_cmdline.vim
@@ -4160,4 +4160,30 @@ func Test_cd_bslash_completion_windows()
let &shellslash = save_shellslash
endfunc
+func Test_msghistory()
+ " After setting 'msghistory' to 2 and outputting a message 4 times with
+ " :echomsg, is the number of output lines of :messages 2?
+ set msghistory=2
+ echomsg 'foo'
+ echomsg 'bar'
+ echomsg 'baz'
+ echomsg 'foobar'
+ call assert_equal(['baz', 'foobar'], GetMessages())
+
+ " When the number of messages is 10 and 'msghistory' is changed to 5, is the
+ " number of output lines of :messages 5?
+ set msghistory=10
+ for num in range(1, 10)
+ echomsg num
+ endfor
+ set msghistory=5
+ call assert_equal(5, len(GetMessages()))
+
+ " Check empty list
+ set msghistory=0
+ call assert_true(empty(GetMessages()))
+
+ set msghistory&
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab