annotate src/testdir/test_excmd.vim @ 19289:2f0f308c069c v8.2.0203

patch 8.2.0203: :helptags and some other functionality not tested Commit: https://github.com/vim/vim/commit/e20b9ececa37a81c0340a78f61e57fa1bf46b06d Author: Bram Moolenaar <Bram@vim.org> Date: Mon Feb 3 21:40:04 2020 +0100 patch 8.2.0203: :helptags and some other functionality not tested Problem: :helptags and some other functionality not tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5567)
author Bram Moolenaar <Bram@vim.org>
date Mon, 03 Feb 2020 21:45:03 +0100
parents b8fd7364befd
children 02111977dd05
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17496
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for various Ex commands.
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
3 source check.vim
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
4
17496
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 func Test_ex_delete()
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 new
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 call setline(1, ['a', 'b', 'c'])
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 2
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 " :dl is :delete with the "l" flag, not :dlist
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 .dl
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 call assert_equal(['a', 'c'], getline(1, 2))
c8152af9fa33 patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 endfunc
17650
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
13
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
14 func Test_range_error()
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
15 call assert_fails(':.echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
16 call assert_fails(':$echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
17 call assert_fails(':1,2echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
18 call assert_fails(':+1echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
19 call assert_fails(':/1/echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
20 call assert_fails(':\/echo 1', 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
21 normal vv
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
22 call assert_fails(":'<,'>echo 1", 'E481:')
a1437b8f2fac patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents: 17496
diff changeset
23 endfunc
18463
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
24
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
25 func Test_buffers_lastused()
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
26 call test_settime(localtime() - 2000) " middle
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
27 edit bufa
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
28 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
29 call test_settime(localtime() - 10) " newest
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
30 edit bufb
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
31 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
32 call test_settime(1550010000) " oldest
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
33 edit bufc
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
34 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
35 call test_settime(0)
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
36 enew
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
37
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
38 let ls = split(execute('buffers t', 'silent!'), '\n')
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
39 let bufs = ls->map({i,v->split(v, '"\s*')[1:2]})
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
40 call assert_equal(['bufb', 'bufa', 'bufc'], bufs[1:]->map({i,v->v[0]}))
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
41 call assert_match('1[0-3] seconds ago', bufs[1][1])
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
42 call assert_match('\d\d:\d\d:\d\d', bufs[2][1])
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
43 call assert_match('2019/02/1\d \d\d:\d\d:00', bufs[3][1])
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
44
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
45 bwipeout bufa
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
46 bwipeout bufb
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
47 bwipeout bufc
18d7337b6837 patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents: 17650
diff changeset
48 endfunc
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
49
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
50 " Test for the :copy command
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
51 func Test_copy()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
52 new
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
53
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
54 call setline(1, ['L1', 'L2', 'L3', 'L4'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
55 " copy lines in a range to inside the range
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
56 1,3copy 2
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
57 call assert_equal(['L1', 'L2', 'L1', 'L2', 'L3', 'L3', 'L4'], getline(1, 7))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
58
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
59 close!
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
60 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
61
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
62 " Test for the :file command
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
63 func Test_file_cmd()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
64 call assert_fails('3file', 'E474:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
65 call assert_fails('0,0file', 'E474:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
66 call assert_fails('0file abc', 'E474:')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
67 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
68
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
69 " Test for the :drop command
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
70 func Test_drop_cmd()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
71 call writefile(['L1', 'L2'], 'Xfile')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
72 enew | only
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
73 drop Xfile
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
74 call assert_equal('L2', getline(2))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
75 " Test for switching to an existing window
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
76 below new
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
77 drop Xfile
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
78 call assert_equal(1, winnr())
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
79 " Test for splitting the current window
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
80 enew | only
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
81 set modified
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
82 drop Xfile
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
83 call assert_equal(2, winnr('$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
84 " Check for setting the argument list
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
85 call assert_equal(['Xfile'], argv())
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
86 enew | only!
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
87 call delete('Xfile')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
88 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
89
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
90 " Test for the :append command
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
91 func Test_append_cmd()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
92 new
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
93 call setline(1, [' L1'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
94 call feedkeys(":append\<CR> L2\<CR> L3\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
95 call assert_equal([' L1', ' L2', ' L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
96 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
97 " append after a specific line
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
98 call setline(1, [' L1', ' L2', ' L3'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
99 call feedkeys(":2append\<CR> L4\<CR> L5\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
100 call assert_equal([' L1', ' L2', ' L4', ' L5', ' L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
101 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
102 " append with toggling 'autoindent'
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
103 call setline(1, [' L1'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
104 call feedkeys(":append!\<CR> L2\<CR> L3\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
105 call assert_equal([' L1', ' L2', ' L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
106 call assert_false(&autoindent)
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
107 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
108 " append with 'autoindent' set and toggling 'autoindent'
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
109 set autoindent
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
110 call setline(1, [' L1'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
111 call feedkeys(":append!\<CR> L2\<CR> L3\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
112 call assert_equal([' L1', ' L2', ' L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
113 call assert_true(&autoindent)
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
114 set autoindent&
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
115 close!
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
116 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
117
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
118 " Test for the :insert command
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
119 func Test_insert_cmd()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
120 new
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
121 call setline(1, [' L1'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
122 call feedkeys(":insert\<CR> L2\<CR> L3\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
123 call assert_equal([' L2', ' L3', ' L1'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
124 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
125 " insert before a specific line
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
126 call setline(1, [' L1', ' L2', ' L3'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
127 call feedkeys(":2insert\<CR> L4\<CR> L5\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
128 call assert_equal([' L1', ' L4', ' L5', ' L2', ' L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
129 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
130 " insert with toggling 'autoindent'
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
131 call setline(1, [' L1'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
132 call feedkeys(":insert!\<CR> L2\<CR> L3\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
133 call assert_equal([' L2', ' L3', ' L1'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
134 call assert_false(&autoindent)
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
135 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
136 " insert with 'autoindent' set and toggling 'autoindent'
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
137 set autoindent
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
138 call setline(1, [' L1'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
139 call feedkeys(":insert!\<CR> L2\<CR> L3\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
140 call assert_equal([' L2', ' L3', ' L1'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
141 call assert_true(&autoindent)
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
142 set autoindent&
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
143 close!
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
144 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
145
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
146 " Test for the :change command
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
147 func Test_change_cmd()
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
148 new
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
149 call setline(1, [' L1', 'L2', 'L3'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
150 call feedkeys(":change\<CR> L4\<CR> L5\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
151 call assert_equal([' L4', ' L5', 'L2', 'L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
152 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
153 " change a specific line
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
154 call setline(1, [' L1', ' L2', ' L3'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
155 call feedkeys(":2change\<CR> L4\<CR> L5\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
156 call assert_equal([' L1', ' L4', ' L5', ' L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
157 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
158 " change with toggling 'autoindent'
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
159 call setline(1, [' L1', 'L2', 'L3'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
160 call feedkeys(":change!\<CR> L4\<CR> L5\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
161 call assert_equal([' L4', ' L5', 'L2', 'L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
162 call assert_false(&autoindent)
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
163 %delete _
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
164 " change with 'autoindent' set and toggling 'autoindent'
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
165 set autoindent
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
166 call setline(1, [' L1', 'L2', 'L3'])
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
167 call feedkeys(":change!\<CR> L4\<CR> L5\<CR>.\<CR>", 'xt')
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
168 call assert_equal([' L4', ' L5', 'L2', 'L3'], getline(1, '$'))
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
169 call assert_true(&autoindent)
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
170 set autoindent&
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
171 close!
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
172 endfunc
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
173
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
174 " Test for the :language command
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
175 func Test_language_cmd()
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
176 CheckFeature multi_lang
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
177
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
178 call assert_fails('language ctype non_existing_lang', 'E197:')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
179 call assert_fails('language time non_existing_lang', 'E197:')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
180 endfunc
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
181
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
182 " Test for the :confirm command dialog
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
183 func Test_confirm_cmd()
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
184 CheckNotGui
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
185 CheckRunVimInTerminal
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
186
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
187 call writefile(['foo1'], 'foo')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
188 call writefile(['bar1'], 'bar')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
189
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
190 " Test for saving all the modified buffers
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
191 let buf = RunVimInTerminal('', {'rows': 20})
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
192 call term_sendkeys(buf, ":set nomore\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
193 call term_sendkeys(buf, ":new foo\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
194 call term_sendkeys(buf, ":call setline(1, 'foo2')\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
195 call term_sendkeys(buf, ":new bar\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
196 call term_sendkeys(buf, ":call setline(1, 'bar2')\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
197 call term_sendkeys(buf, ":wincmd b\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
198 call term_sendkeys(buf, ":confirm qall\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
199 call WaitForAssert({-> assert_match('\[Y\]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: ', term_getline(buf, 20))}, 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
200 call term_sendkeys(buf, "A")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
201 call StopVimInTerminal(buf)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
202
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
203 call assert_equal(['foo2'], readfile('foo'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
204 call assert_equal(['bar2'], readfile('bar'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
205
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
206 " Test for discarding all the changes to modified buffers
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
207 let buf = RunVimInTerminal('', {'rows': 20})
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
208 call term_sendkeys(buf, ":set nomore\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
209 call term_sendkeys(buf, ":new foo\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
210 call term_sendkeys(buf, ":call setline(1, 'foo3')\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
211 call term_sendkeys(buf, ":new bar\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
212 call term_sendkeys(buf, ":call setline(1, 'bar3')\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
213 call term_sendkeys(buf, ":wincmd b\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
214 call term_sendkeys(buf, ":confirm qall\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
215 call WaitForAssert({-> assert_match('\[Y\]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: ', term_getline(buf, 20))}, 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
216 call term_sendkeys(buf, "D")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
217 call StopVimInTerminal(buf)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
218
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
219 call assert_equal(['foo2'], readfile('foo'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
220 call assert_equal(['bar2'], readfile('bar'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
221
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
222 " Test for saving and discarding changes to some buffers
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
223 let buf = RunVimInTerminal('', {'rows': 20})
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
224 call term_sendkeys(buf, ":set nomore\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
225 call term_sendkeys(buf, ":new foo\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
226 call term_sendkeys(buf, ":call setline(1, 'foo4')\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
227 call term_sendkeys(buf, ":new bar\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
228 call term_sendkeys(buf, ":call setline(1, 'bar4')\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
229 call term_sendkeys(buf, ":wincmd b\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
230 call term_sendkeys(buf, ":confirm qall\n")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
231 call WaitForAssert({-> assert_match('\[Y\]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: ', term_getline(buf, 20))}, 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
232 call term_sendkeys(buf, "N")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
233 call WaitForAssert({-> assert_match('\[Y\]es, (N)o, (C)ancel: ', term_getline(buf, 20))}, 1000)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
234 call term_sendkeys(buf, "Y")
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
235 call StopVimInTerminal(buf)
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
236
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
237 call assert_equal(['foo4'], readfile('foo'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
238 call assert_equal(['bar2'], readfile('bar'))
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
239
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
240 call delete('foo')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
241 call delete('bar')
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
242 endfunc
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 19231
diff changeset
243
19231
b8fd7364befd patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents: 18463
diff changeset
244 " vim: shiftwidth=2 sts=2 expandtab