Mercurial > vim
annotate src/testdir/test_excmd.vim @ 19283:9dc843109c97 v8.2.0200
patch 8.2.0200: Vim9 script commands not sufficiently tested
Commit: https://github.com/vim/vim/commit/b283a8a6802ef8a46b17cb439f9514840c03698f
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 2 22:24:04 2020 +0100
patch 8.2.0200: Vim9 script commands not sufficiently tested
Problem: Vim9 script commands not sufficiently tested.
Solution: Add more tests. Fix storing global variable. Make script
variables work.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 02 Feb 2020 22:30:04 +0100 |
parents | b8fd7364befd |
children | 2f0f308c069c |
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 |
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 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
|
4 new |
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 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
|
6 2 |
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 " :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
|
8 .dl |
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 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
|
10 endfunc |
17650
a1437b8f2fac
patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents:
17496
diff
changeset
|
11 |
a1437b8f2fac
patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents:
17496
diff
changeset
|
12 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
|
13 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
|
14 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
|
15 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
|
16 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
|
17 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
|
18 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
|
19 normal vv |
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 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
|
22 |
18d7337b6837
patch 8.1.2225: the "last used" info of a buffer is under used
Bram Moolenaar <Bram@vim.org>
parents:
17650
diff
changeset
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
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 |
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 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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 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
|
42 |
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 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
|
44 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
|
45 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
|
46 endfunc |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
47 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
48 " Test for the :copy command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
49 func Test_copy() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
50 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
51 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
52 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
|
53 " 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
|
54 1,3copy 2 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
55 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
|
56 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
57 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
58 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
59 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
60 " Test for the :file command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
61 func Test_file_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
62 call assert_fails('3file', 'E474:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
63 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
|
64 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
|
65 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
66 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
67 " Test for the :drop command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
68 func Test_drop_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
69 call writefile(['L1', 'L2'], 'Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
70 enew | only |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
71 drop Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
72 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
|
73 " 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
|
74 below new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
75 drop Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
76 call assert_equal(1, winnr()) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
77 " 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
|
78 enew | only |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
79 set modified |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
80 drop Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
81 call assert_equal(2, winnr('$')) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
82 " 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
|
83 call assert_equal(['Xfile'], argv()) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
84 enew | only! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
85 call delete('Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
86 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
87 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
88 " Test for the :append command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
89 func Test_append_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
90 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
91 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
92 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
|
93 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
|
94 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
95 " append after a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
96 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
|
97 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
|
98 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
|
99 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
100 " append with toggling 'autoindent' |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
101 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
102 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
|
103 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
|
104 call assert_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
105 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
106 " 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
|
107 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
108 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
109 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
|
110 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
|
111 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
112 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
113 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
114 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
115 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
116 " Test for the :insert command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
117 func Test_insert_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
118 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
119 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
120 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
|
121 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
|
122 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
123 " insert before a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
128 " insert with toggling 'autoindent' |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
129 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
130 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
|
131 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
|
132 call assert_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
133 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
134 " 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
|
135 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
136 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
137 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
|
138 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
|
139 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
140 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
141 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
142 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
143 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
144 " Test for the :change command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
145 func Test_change_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
146 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
147 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
|
148 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
|
149 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
|
150 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
151 " change a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
152 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
|
153 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
|
154 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
|
155 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
156 " change with toggling 'autoindent' |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
157 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
|
158 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
|
159 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
|
160 call assert_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
161 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
162 " 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
|
163 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
164 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
|
165 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
|
166 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
|
167 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
168 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
169 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
170 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
171 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
172 " vim: shiftwidth=2 sts=2 expandtab |