annotate src/testdir/test_messages.vim @ 15097:1946487c74ba v8.1.0559

patch 8.1.0559: command line completion not sufficiently tested commit https://github.com/vim/vim/commit/b513d3079bbe3f59a1f1a3d6931939a76cd7e54a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 2 14:55:08 2018 +0100 patch 8.1.0559: command line completion not sufficiently tested Problem: Command line completion not sufficiently tested. Solution: Add more tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/3622)
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Dec 2018 15:00:05 +0100
parents 51693b1a640e
children dada0b389d4f
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
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
7 " Avoid the "message maintainer" line.
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
8 let $LANG = ''
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 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
11 for s in arr
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 echomsg s | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 endfor
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 let result = ''
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
16 " get last two messages
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 redir => result
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 2messages | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 redir END
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
20 let msg_list = split(result, "\n")
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
21 call assert_equal(["hello8", "hello9"], msg_list)
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " clear messages without last one
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 1messages clear
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 redir => result
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
26 redraw | messages
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 redir END
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
28 let msg_list = split(result, "\n")
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
29 call assert_equal(['hello9'], msg_list)
8897
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
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
34 redraw | messages
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 redir END
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
36 call assert_equal('', result)
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 finally
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 let &more = oldmore
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 endtry
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 endfunction
13968
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
41
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 13968
diff changeset
42 " Patch 7.4.1696 defined the "clearmode()" function for clearing the mode
13968
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
43 " indicator (e.g., "-- INSERT --") when ":stopinsert" is invoked. Message
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
44 " output could then be disturbed when 'cmdheight' was greater than one.
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
45 " This test ensures that the bugfix for this issue remains in place.
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
46 function! Test_stopinsert_does_not_break_message_output()
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
47 set cmdheight=2
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
48 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
49
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
50 stopinsert | echo 'test echo'
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
51 call assert_equal(116, screenchar(&lines - 1, 1))
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
52 call assert_equal(32, screenchar(&lines, 1))
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
53 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
54
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
55 stopinsert | echomsg 'test echomsg'
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
56 call assert_equal(116, screenchar(&lines - 1, 1))
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
57 call assert_equal(32, screenchar(&lines, 1))
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
58 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
59
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
60 set cmdheight&
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
61 endfunction
15097
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
62
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
63 func Test_message_completion()
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
64 call feedkeys(":message \<C-A>\<C-B>\"\<CR>", 'tx')
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
65 call assert_equal('"message clear', @:)
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
66 endfunc