aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2016-11-26 16:34:52 -0700
committerMichael Ennen <mike.ennen@gmail.com>2016-11-29 16:32:43 -0700
commitd2be11fbf21ee37d6ae86818f2c1790ecf8fecca (patch)
treeaaeef15cca0f276f6894331e6d9e68e5e2f23367 /src/nvim/testdir
parent3979c6cbed6399934a06da35881e4d351c588af0 (diff)
downloadrneovim-d2be11fbf21ee37d6ae86818f2c1790ecf8fecca.tar.gz
rneovim-d2be11fbf21ee37d6ae86818f2c1790ecf8fecca.tar.bz2
rneovim-d2be11fbf21ee37d6ae86818f2c1790ecf8fecca.zip
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
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_alot.vim1
-rw-r--r--src/nvim/testdir/test_messages.vim42
2 files changed, 43 insertions, 0 deletions
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