From d2be11fbf21ee37d6ae86818f2c1790ecf8fecca Mon Sep 17 00:00:00 2001 From: Michael Ennen Date: Sat, 26 Nov 2016 16:34:52 -0700 Subject: vim-patch:7.4.1735 Problem: It is not possible to only see part of the message history. It is not possible to clear messages. Solution: Add a count to ":messages" and a clear argument. (Yasuhiro Matsumoto) https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6 --- src/nvim/testdir/test_alot.vim | 1 + src/nvim/testdir/test_messages.vim | 42 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 src/nvim/testdir/test_messages.vim (limited to 'src/nvim/testdir') diff --git a/src/nvim/testdir/test_alot.vim b/src/nvim/testdir/test_alot.vim index 4e8cd54ce3..5a71b4fdd1 100644 --- a/src/nvim/testdir/test_alot.vim +++ b/src/nvim/testdir/test_alot.vim @@ -9,6 +9,7 @@ source test_expr.vim source test_expr_utf8.vim source test_feedkeys.vim source test_menu.vim +source test_messages.vim source test_options.vim source test_popup.vim source test_regexp_utf8.vim diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim new file mode 100644 index 0000000000..4d7e41130c --- /dev/null +++ b/src/nvim/testdir/test_messages.vim @@ -0,0 +1,42 @@ +" Tests for :messages + +function Test_messages() + let oldmore = &more + try + set nomore + + let arr = map(range(10), '"hello" . v:val') + for s in arr + echomsg s | redraw + endfor + let result = '' + + redir => result + 2messages | redraw + redir END + + " get last two messages + let msg = split(result, "\n")[1:][-2:] + call assert_equal(["hello8", "hello9"], msg) + + " clear messages without last one + 1messages clear + redir => result + redraw | 1messages + redir END + " get last last message + let msg = split(result, "\n")[1:][-1:] + call assert_equal(['hello9'], msg) + + " clear all messages + messages clear + redir => result + redraw | 1messages + redir END + " get last last message + let msg = split(result, "\n")[1:][-1:] + call assert_equal([], msg) + finally + let &more = oldmore + endtry +endfunction -- cgit