annotate src/testdir/test_messages.vim @ 20166:c75be957c6fb v8.2.0638

patch 8.2.0638: MS-Windows: messages test fails Commit: https://github.com/vim/vim/commit/47a1a8baf9c8eb22b24f667e57a1dab579999a74 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 25 16:41:58 2020 +0200 patch 8.2.0638: MS-Windows: messages test fails Problem: MS-Windows: messages test fails. Solution: Clear environment variables.
author Bram Moolenaar <Bram@vim.org>
date Sat, 25 Apr 2020 16:45:04 +0200
parents 94f05de75e9f
children be661435893a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15219
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
1 " Tests for :messages, :echomsg, :echoerr
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
3 source shared.vim
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
4 source term_util.vim
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
5
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 function Test_messages()
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 let oldmore = &more
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 try
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 set nomore
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
10 " Avoid the "message maintainer" line.
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
11 let $LANG = ''
20166
c75be957c6fb patch 8.2.0638: MS-Windows: messages test fails
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
12 let $LC_ALL = ''
c75be957c6fb patch 8.2.0638: MS-Windows: messages test fails
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
13 let $LC_MESSAGES = ''
c75be957c6fb patch 8.2.0638: MS-Windows: messages test fails
Bram Moolenaar <Bram@vim.org>
parents: 20158
diff changeset
14 let $LC_COLLATE = ''
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 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
17 for s in arr
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 echomsg s | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 endfor
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 let result = ''
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
22 " get last two messages
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 redir => result
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 2messages | redraw
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 redir END
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
26 let msg_list = split(result, "\n")
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
27 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
28
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " clear messages without last one
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 1messages clear
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 redir => result
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
32 redraw | messages
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 redir END
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
34 let msg_list = split(result, "\n")
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
35 call assert_equal(['hello9'], msg_list)
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 " clear all messages
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 messages clear
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 redir => result
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
40 redraw | messages
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 redir END
8905
9200836eee15 commit https://github.com/vim/vim/commit/bea1ede1c59a11ca5bf9d91cd30b7b2937b9fb41
Christian Brabandt <cb@256bit.org>
parents: 8897
diff changeset
42 call assert_equal('', result)
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 finally
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 let &more = oldmore
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 endtry
20041
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
46
3601e816a569 patch 8.2.0576: some errors are not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
47 call assert_fails('message 1', 'E474:')
8897
a410390e340b commit https://github.com/vim/vim/commit/451f849fd6282a4facd4f0f58af62837443fb5a6
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 endfunction
13968
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
49
14202
51693b1a640e patch 8.1.0118: duplicate error message for put command
Christian Brabandt <cb@256bit.org>
parents: 13968
diff changeset
50 " 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
51 " 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
52 " 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
53 " This test ensures that the bugfix for this issue remains in place.
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 15219
diff changeset
54 func Test_stopinsert_does_not_break_message_output()
13968
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
55 set cmdheight=2
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
56 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
57
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
58 stopinsert | echo 'test echo'
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
59 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
60 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
61 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
62
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
63 stopinsert | echomsg 'test echomsg'
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
64 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
65 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
66 redraw!
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
67
d111462e0173 patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents: 8905
diff changeset
68 set cmdheight&
15406
63b02fcf1361 patch 8.1.0711: test files still use function!
Bram Moolenaar <Bram@vim.org>
parents: 15219
diff changeset
69 endfunc
15097
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
70
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
71 func Test_message_completion()
1946487c74ba patch 8.1.0559: command line completion not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 14202
diff changeset
72 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
73 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
74 endfunc
15219
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
75
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
76 func Test_echomsg()
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
77 call assert_equal("\nhello", execute(':echomsg "hello"'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
78 call assert_equal("\n", execute(':echomsg ""'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
79 call assert_equal("\n12345", execute(':echomsg 12345'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
80 call assert_equal("\n[]", execute(':echomsg []'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
81 call assert_equal("\n[1, 2, 3]", execute(':echomsg [1, 2, 3]'))
20126
831b1ea43020 patch 8.2.0618: echoing a null list results in no output
Bram Moolenaar <Bram@vim.org>
parents: 20041
diff changeset
82 call assert_equal("\n[1, 2, []]", execute(':echomsg [1, 2, test_null_list()]'))
15219
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
83 call assert_equal("\n{}", execute(':echomsg {}'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
84 call assert_equal("\n{'a': 1, 'b': 2}", execute(':echomsg {"a": 1, "b": 2}'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
85 if has('float')
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
86 call assert_equal("\n1.23", execute(':echomsg 1.23'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
87 endif
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
88 call assert_match("function('<lambda>\\d*')", execute(':echomsg {-> 1234}'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
89 endfunc
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
90
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
91 func Test_echoerr()
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
92 call test_ignore_error('IgNoRe')
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
93 call assert_equal("\nIgNoRe hello", execute(':echoerr "IgNoRe hello"'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
94 call assert_equal("\n12345 IgNoRe", execute(':echoerr 12345 "IgNoRe"'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
95 call assert_equal("\n[1, 2, 'IgNoRe']", execute(':echoerr [1, 2, "IgNoRe"]'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
96 call assert_equal("\n{'IgNoRe': 2, 'a': 1}", execute(':echoerr {"a": 1, "IgNoRe": 2}'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
97 if has('float')
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
98 call assert_equal("\n1.23 IgNoRe", execute(':echoerr 1.23 "IgNoRe"'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
99 endif
18031
8a2fb21c23c0 patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17833
diff changeset
100 eval '<lambda>'->test_ignore_error()
15219
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
101 call assert_match("function('<lambda>\\d*')", execute(':echoerr {-> 1234}'))
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
102 call test_ignore_error('RESET')
dada0b389d4f patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents: 15097
diff changeset
103 endfunc
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
104
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
105 func Test_mode_message_at_leaving_insert_by_ctrl_c()
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
106 if !has('terminal') || has('gui_running')
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
107 return
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
108 endif
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
109
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
110 " Set custom statusline built by user-defined function.
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
111 let testfile = 'Xtest.vim'
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
112 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
113 func StatusLine() abort
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
114 return ""
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
115 endfunc
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
116 set statusline=%!StatusLine()
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
117 set laststatus=2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
118 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
119 call writefile(lines, testfile)
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
120
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
121 let rows = 10
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
122 let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19754
diff changeset
123 call TermWait(buf, 100)
16368
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
124 call assert_equal('run', job_status(term_getjob(buf)))
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
125
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
126 call term_sendkeys(buf, "i")
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
127 call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))})
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
128 call term_sendkeys(buf, "\<C-C>")
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
129 call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))})
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
130
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
131 call term_sendkeys(buf, ":qall!\<CR>")
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
132 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
133 exe buf . 'bwipe!'
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
134 call delete(testfile)
a3b5cbd2effe patch 8.1.1189: mode is not cleared when leaving Insert mode
Bram Moolenaar <Bram@vim.org>
parents: 15406
diff changeset
135 endfunc
16374
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
136
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
137 func Test_mode_message_at_leaving_insert_with_esc_mapped()
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
138 if !has('terminal') || has('gui_running')
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
139 return
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
140 endif
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
141
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
142 " Set custom statusline built by user-defined function.
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
143 let testfile = 'Xtest.vim'
17172
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
144 let lines =<< trim END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
145 set laststatus=2
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
146 inoremap <Esc> <Esc>00
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
147 END
6990c1160ea5 patch 8.1.1585: :let-heredoc does not trim enough
Bram Moolenaar <Bram@vim.org>
parents: 16374
diff changeset
148 call writefile(lines, testfile)
16374
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
149
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
150 let rows = 10
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
151 let buf = term_start([GetVimProg(), '--clean', '-S', testfile], {'term_rows': rows})
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 19754
diff changeset
152 call WaitForAssert({-> assert_match('0,0-1\s*All$', term_getline(buf, rows - 1))})
16374
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
153 call assert_equal('run', job_status(term_getjob(buf)))
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
154
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
155 call term_sendkeys(buf, "i")
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
156 call WaitForAssert({-> assert_match('^-- INSERT --\s*$', term_getline(buf, rows))})
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
157 call term_sendkeys(buf, "\<Esc>")
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
158 call WaitForAssert({-> assert_match('^\s*$', term_getline(buf, rows))})
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
159
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
160 call term_sendkeys(buf, ":qall!\<CR>")
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
161 call WaitForAssert({-> assert_equal('dead', job_status(term_getjob(buf)))})
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
162 exe buf . 'bwipe!'
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
163 call delete(testfile)
57c37c17ff9d patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents: 16368
diff changeset
164 endfunc
17833
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
165
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
166 func Test_echospace()
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
167 set noruler noshowcmd laststatus=1
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
168 call assert_equal(&columns - 1, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
169 split
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
170 call assert_equal(&columns - 1, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
171 set ruler
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
172 call assert_equal(&columns - 1, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
173 close
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
174 call assert_equal(&columns - 19, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
175 set showcmd noruler
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
176 call assert_equal(&columns - 12, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
177 set showcmd ruler
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
178 call assert_equal(&columns - 29, v:echospace)
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
179
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
180 set ruler& showcmd&
8377ec7c5824 patch 8.1.1913: not easy to compute the space on the command line
Bram Moolenaar <Bram@vim.org>
parents: 17172
diff changeset
181 endfunc
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
182
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
183 " Test more-prompt (see :help more-prompt).
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
184 func Test_message_more()
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
185 if !CanRunVimInTerminal()
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
186 throw 'Skipped: cannot run vim in terminal'
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
187 endif
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
188 let buf = RunVimInTerminal('', {'rows': 6})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
189 call term_sendkeys(buf, ":call setline(1, range(1, 100))\n")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
190
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
191 call term_sendkeys(buf, ":%p#\n")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
192 call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
193 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
194
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
195 call term_sendkeys(buf, '?')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
196 call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
197 call WaitForAssert({-> assert_equal('-- More -- SPACE/d/j: screen/page/line down, b/u/k: up, q: quit ', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
198
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
199 " Down a line with j, <CR>, <NL> or <Down>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
200 call term_sendkeys(buf, "j")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
201 call WaitForAssert({-> assert_equal(' 6 6', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
202 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
203 call term_sendkeys(buf, "\<NL>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
204 call WaitForAssert({-> assert_equal(' 7 7', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
205 call term_sendkeys(buf, "\<CR>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
206 call WaitForAssert({-> assert_equal(' 8 8', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
207 call term_sendkeys(buf, "\<Down>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
208 call WaitForAssert({-> assert_equal(' 9 9', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
209
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
210 " Down a screen with <Space>, f, or <PageDown>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
211 call term_sendkeys(buf, 'f')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
212 call WaitForAssert({-> assert_equal(' 14 14', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
213 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
214 call term_sendkeys(buf, ' ')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
215 call WaitForAssert({-> assert_equal(' 19 19', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
216 call term_sendkeys(buf, "\<PageDown>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
217 call WaitForAssert({-> assert_equal(' 24 24', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
218
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
219 " Down a page (half a screen) with d.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
220 call term_sendkeys(buf, 'd')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
221 call WaitForAssert({-> assert_equal(' 27 27', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
222
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
223 " Down all the way with 'G'.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
224 call term_sendkeys(buf, 'G')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
225 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
226 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
227
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
228 " Up a line k, <BS> or <Up>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
229 call term_sendkeys(buf, 'k')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
230 call WaitForAssert({-> assert_equal(' 99 99', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
231 call term_sendkeys(buf, "\<BS>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
232 call WaitForAssert({-> assert_equal(' 98 98', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
233 call term_sendkeys(buf, "\<Up>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
234 call WaitForAssert({-> assert_equal(' 97 97', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
235
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
236 " Up a screen with b or <PageUp>.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
237 call term_sendkeys(buf, 'b')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
238 call WaitForAssert({-> assert_equal(' 92 92', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
239 call term_sendkeys(buf, "\<PageUp>")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
240 call WaitForAssert({-> assert_equal(' 87 87', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
241
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
242 " Up a page (half a screen) with u.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
243 call term_sendkeys(buf, 'u')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
244 call WaitForAssert({-> assert_equal(' 84 84', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
245
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
246 " Up all the way with 'g'.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
247 call term_sendkeys(buf, 'g')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
248 call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
249 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
250
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
251 " All the way down. Pressing f should do nothing but pressing
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
252 " space should end the more prompt.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
253 call term_sendkeys(buf, 'G')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
254 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
255 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
256 call term_sendkeys(buf, 'f')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
257 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
258 call term_sendkeys(buf, ' ')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
259 call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
260
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
261 " Pressing g< shows the previous command output.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
262 call term_sendkeys(buf, 'g<')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
263 call WaitForAssert({-> assert_equal('100 100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
264 call WaitForAssert({-> assert_equal('Press ENTER or type command to continue', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
265
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
266 call term_sendkeys(buf, ":%p#\n")
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
267 call WaitForAssert({-> assert_equal(' 5 5', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
268 call WaitForAssert({-> assert_equal('-- More --', term_getline(buf, 6))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
269
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
270 " Stop command output with q, <Esc> or CTRL-C.
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
271 call term_sendkeys(buf, 'q')
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
272 call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
273
19279
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
274 call StopVimInTerminal(buf)
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
275 endfunc
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
276
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
277 func Test_ask_yesno()
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
278 if !CanRunVimInTerminal()
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
279 throw 'Skipped: cannot run vim in terminal'
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
280 endif
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
281 let buf = RunVimInTerminal('', {'rows': 6})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
282 call term_sendkeys(buf, ":call setline(1, range(1, 2))\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
283
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
284 call term_sendkeys(buf, ":2,1s/^/n/\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
285 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
286 call term_sendkeys(buf, "n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
287 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
288 call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
289
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
290 call term_sendkeys(buf, ":2,1s/^/Esc/\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
291 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
292 call term_sendkeys(buf, "\<Esc>")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
293 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
294 call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
295
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
296 call term_sendkeys(buf, ":2,1s/^/y/\n")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
297 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
298 call term_sendkeys(buf, "y")
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
299 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?y *2,1 *All$', term_getline(buf, 6))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
300 call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
301 call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
25cb7ab433c6 patch 8.2.0198: no tests for y/n prompt
Bram Moolenaar <Bram@vim.org>
parents: 19083
diff changeset
302
18983
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
303 call StopVimInTerminal(buf)
54baf548bff9 patch 8.2.0052: more-prompt not properly tested
Bram Moolenaar <Bram@vim.org>
parents: 18031
diff changeset
304 endfunc
19081
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
305
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
306 func Test_null()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
307 echom test_null_list()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
308 echom test_null_dict()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
309 echom test_null_blob()
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
310 echom test_null_string()
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20126
diff changeset
311 echom test_null_function()
19081
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
312 echom test_null_partial()
19083
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
313 if has('job')
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
314 echom test_null_job()
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
315 echom test_null_channel()
82410cbaa042 patch 8.2.0102: messages test fails in small version
Bram Moolenaar <Bram@vim.org>
parents: 19081
diff changeset
316 endif
19081
3b1f83fdaabc patch 8.2.0101: crash when passing null object to ":echomsg"
Bram Moolenaar <Bram@vim.org>
parents: 18983
diff changeset
317 endfunc
20158
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20126
diff changeset
318
94f05de75e9f patch 8.2.0634: crash with null partial and blob
Bram Moolenaar <Bram@vim.org>
parents: 20126
diff changeset
319 " vim: shiftwidth=2 sts=2 expandtab