annotate src/testdir/test_messages.vim @ 8897:a410390e340b v7.4.1735

commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 14 17:16:22 2016 +0200 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)
author Christian Brabandt <cb@256bit.org>
date Thu, 14 Apr 2016 17:30:07 +0200
parents
children 9200836eee15
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for :messages
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 function Test_messages()
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 let oldmore = &more
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 try
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 set nomore
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 let arr = map(range(10), '"hello" . v:val')
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 for s in arr
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 echomsg s | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 endfor
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 let result = ''
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 redir => result
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 2messages | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 redir END
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " get last two messages
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 let msg = split(result, "\n")[1:][-2:]
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call assert_equal(["hello8", "hello9"], msg)
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " clear messages without last one
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 1messages clear
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 redir => result
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 redraw | 1messages
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 redir END
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " get last last message
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 let msg = split(result, "\n")[1:][-1:]
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 call assert_equal(['hello9'], msg)
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " clear all messages
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 messages clear
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 redir => result
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 redraw | 1messages
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 redir END
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 " get last last message
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 let msg = split(result, "\n")[1:][-1:]
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal([], msg)
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 finally
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 let &more = oldmore
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 endtry
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 endfunction