Mercurial > vim
annotate src/testdir/test_excmd.vim @ 19740:a653d1a165ef v8.2.0426
patch 8.2.0426: some errors were not tested for
Commit: https://github.com/vim/vim/commit/9b9be007e7d674f49fc2b650f840d08532b180ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 22 14:41:22 2020 +0100
patch 8.2.0426: some errors were not tested for
Problem: Some errors were not tested for.
Solution: Add tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/5824)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 22 Mar 2020 14:45:04 +0100 |
parents | da98d2ed8dc5 |
children | c9cc9e5c87e0 |
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:') |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
23 call assert_fails(":\\xcenter", 'E10:') |
17650
a1437b8f2fac
patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents:
17496
diff
changeset
|
24 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
|
25 |
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 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
|
27 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
|
28 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
|
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(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
|
31 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
|
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(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
|
34 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
|
35 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
|
36 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
|
37 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
|
38 |
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 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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 |
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 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
|
47 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
|
48 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
|
49 endfunc |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
50 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
51 " Test for the :copy command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
52 func Test_copy() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
53 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
54 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
55 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
|
56 " 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
|
57 1,3copy 2 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
58 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
|
59 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
60 " Specifying a count before using : to run an ex-command |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
61 exe "normal! gg4:yank\<CR>" |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
62 call assert_equal("L1\nL2\nL1\nL2\n", @") |
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
63 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
64 close! |
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 :file command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
68 func Test_file_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
69 call assert_fails('3file', 'E474:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
70 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
|
71 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
|
72 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
73 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
74 " Test for the :drop command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
75 func Test_drop_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
76 call writefile(['L1', 'L2'], 'Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
77 enew | only |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
78 drop Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
79 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
|
80 " 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
|
81 below new |
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(1, winnr()) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
84 " 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
|
85 enew | only |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
86 set modified |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
87 drop Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
88 call assert_equal(2, winnr('$')) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
89 " 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
|
90 call assert_equal(['Xfile'], argv()) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
91 enew | only! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
92 call delete('Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
93 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
94 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
95 " Test for the :append command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
96 func Test_append_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
97 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
98 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
99 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
|
100 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
|
101 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
102 " append after a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
103 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
|
104 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
|
105 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
|
106 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
107 " append with toggling '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_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
112 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
113 " 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
|
114 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
115 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
116 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
|
117 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
|
118 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
119 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
120 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
121 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
122 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
123 " Test for the :insert command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
124 func Test_insert_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
125 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
126 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
127 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
|
128 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
|
129 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
130 " insert before a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
131 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
|
132 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
|
133 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
|
134 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
135 " insert with toggling '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_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
140 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
141 " 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
|
142 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
143 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
144 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
|
145 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
|
146 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
147 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
148 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
149 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
150 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
151 " Test for the :change command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
152 func Test_change_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
153 new |
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(":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
|
156 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
|
157 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
158 " change a specific line |
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(":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
|
161 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
|
162 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
163 " change with toggling '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_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
168 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
169 " 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
|
170 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
171 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
|
172 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
|
173 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
|
174 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
175 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
176 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
177 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
178 |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
179 " 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
|
180 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
|
181 CheckFeature multi_lang |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
182 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
183 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
|
184 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
|
185 endfunc |
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 " 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
|
188 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
|
189 CheckNotGui |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
190 CheckRunVimInTerminal |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
191 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
192 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
|
193 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
|
194 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
195 " 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 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
|
205 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
|
206 call StopVimInTerminal(buf) |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
207 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
208 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
|
209 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
|
210 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
211 " 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
|
212 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
|
213 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
|
214 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
|
215 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
|
216 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
|
217 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 call StopVimInTerminal(buf) |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
223 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
224 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
|
225 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
|
226 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
227 " 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 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
|
235 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
|
236 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
|
237 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
|
238 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
|
239 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
|
240 call StopVimInTerminal(buf) |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
241 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
242 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
|
243 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
|
244 |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
245 " Test for closing a window with a modified buffer |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
246 let buf = RunVimInTerminal('', {'rows': 20}) |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
247 call term_sendkeys(buf, ":set nomore\n") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
248 call term_sendkeys(buf, ":new\n") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
249 call term_sendkeys(buf, ":call setline(1, 'abc')\n") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
250 call term_sendkeys(buf, ":confirm close\n") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
251 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
252 \ term_getline(buf, 20))}, 1000) |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
253 call term_sendkeys(buf, "C") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
254 call term_sendkeys(buf, ":confirm close\n") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
255 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
256 \ term_getline(buf, 20))}, 1000) |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
257 call term_sendkeys(buf, "N") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
258 call term_sendkeys(buf, ":quit\n") |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
259 call StopVimInTerminal(buf) |
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
260 |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
261 call delete('foo') |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
262 call delete('bar') |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
263 endfunc |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
264 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
265 " Test for the :print command |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
266 func Test_print_cmd() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
267 call assert_fails('print', 'E749:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
268 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
269 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
270 " Test for the :winsize command |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
271 func Test_winsize_cmd() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
272 call assert_fails('winsize 1', 'E465:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
273 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
274 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
275 " Test for the :redir command |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
276 func Test_redir_cmd() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
277 call assert_fails('redir @@', 'E475:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
278 call assert_fails('redir abc', 'E475:') |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
279 call assert_fails('redir => 1abc', 'E474:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
280 call assert_fails('redir => a b', 'E488:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
281 call assert_fails('redir => abc[1]', 'E474:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
282 let b=0zFF |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
283 call assert_fails('redir =>> b', 'E734:') |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
284 unlet b |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
285 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
286 if has('unix') |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
287 " Redirecting to a directory name |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
288 call mkdir('Xdir') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
289 call assert_fails('redir > Xdir', 'E17:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
290 call delete('Xdir', 'd') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
291 endif |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
292 if !has('bsd') |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
293 " Redirecting to a read-only file |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
294 call writefile([], 'Xfile') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
295 call setfperm('Xfile', 'r--r--r--') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
296 call assert_fails('redir! > Xfile', 'E190:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
297 call delete('Xfile') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
298 endif |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
299 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
300 " Test for redirecting to a register |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
301 redir @q> | echon 'clean ' | redir END |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
302 redir @q>> | echon 'water' | redir END |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
303 call assert_equal('clean water', @q) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
304 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
305 " Test for redirecting to a variable |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
306 redir => color | echon 'blue ' | redir END |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
307 redir =>> color | echon 'sky' | redir END |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
308 call assert_equal('blue sky', color) |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
309 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
310 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
311 " Test for the :filetype command |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
312 func Test_filetype_cmd() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
313 call assert_fails('filetype abc', 'E475:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
314 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
315 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
316 " Test for the :mode command |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
317 func Test_mode_cmd() |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
318 call assert_fails('mode abc', 'E359:') |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
319 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
320 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
321 " Test for the :sleep command |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
322 func Test_sleep_cmd() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
323 call assert_fails('sleep x', 'E475:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
324 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
325 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
326 " Test for the :read command |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
327 func Test_read_cmd() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
328 call writefile(['one'], 'Xfile') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
329 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
330 call assert_fails('read', 'E32:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
331 edit Xfile |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
332 read |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
333 call assert_equal(['one', 'one'], getline(1, '$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
334 close! |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
335 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
336 read Xfile |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
337 call assert_equal(['', 'one'], getline(1, '$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
338 call deletebufline('', 1, '$') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
339 call feedkeys("Qr Xfile\<CR>visual\<CR>", 'xt') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
340 call assert_equal(['one'], getline(1, '$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
341 close! |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
342 call delete('Xfile') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
343 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
344 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
345 " Test for running Ex commands when text is locked. |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
346 " <C-\>e in the command line is used to lock the text |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
347 func Test_run_excmd_with_text_locked() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
348 " :quit |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
349 let cmd = ":\<C-\>eexecute('quit')\<CR>\<C-C>" |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
350 call assert_fails("call feedkeys(cmd, 'xt')", 'E523:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
351 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
352 " :qall |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
353 let cmd = ":\<C-\>eexecute('qall')\<CR>\<C-C>" |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
354 call assert_fails("call feedkeys(cmd, 'xt')", 'E523:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
355 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
356 " :exit |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
357 let cmd = ":\<C-\>eexecute('exit')\<CR>\<C-C>" |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
358 call assert_fails("call feedkeys(cmd, 'xt')", 'E523:') |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
359 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
360 " :close - should be ignored |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
361 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
362 let cmd = ":\<C-\>eexecute('close')\<CR>\<C-C>" |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
363 call assert_equal(2, winnr('$')) |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
364 close |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
365 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
366 call assert_fails("call feedkeys(\":\<C-R>=execute('bnext')\<CR>\", 'xt')", 'E523:') |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
367 endfunc |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
368 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
369 " Test for the :verbose command |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
370 func Test_verbose_cmd() |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
371 call assert_equal([' verbose=1'], split(execute('verbose set vbs'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
372 call assert_equal([' verbose=0'], split(execute('0verbose set vbs'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
373 let l = execute("4verbose set verbose | set verbose") |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
374 call assert_equal([' verbose=4', ' verbose=0'], split(l, "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
375 endfunc |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
376 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
377 " Test for the :delete command and the related abbreviated commands |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
378 func Test_excmd_delete() |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
379 new |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
380 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
381 call assert_equal(['^Ibar$'], split(execute('dl'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
382 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
383 call assert_equal(['^Ibar$'], split(execute('dell'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
384 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
385 call assert_equal(['^Ibar$'], split(execute('delel'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
386 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
387 call assert_equal(['^Ibar$'], split(execute('deletl'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
388 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
389 call assert_equal(['^Ibar$'], split(execute('deletel'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
390 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
391 call assert_equal([' bar'], split(execute('dp'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
392 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
393 call assert_equal([' bar'], split(execute('dep'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
394 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
395 call assert_equal([' bar'], split(execute('delp'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
396 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
397 call assert_equal([' bar'], split(execute('delep'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
398 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
399 call assert_equal([' bar'], split(execute('deletp'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
400 call setline(1, ['foo', "\tbar"]) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
401 call assert_equal([' bar'], split(execute('deletep'), "\n")) |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
402 close! |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
403 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
404 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
405 " vim: shiftwidth=2 sts=2 expandtab |