Mercurial > vim
annotate src/testdir/test_excmd.vim @ 35120:a9ee3031a1bb default tip
Added tag v9.1.0393 for changeset 7d6bce8d8875e7deec699d688e081b1450243bb6
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 04 May 2024 10:00:06 +0200 |
parents | 3b8ed014a445 |
children |
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 |
26848
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
4 source shared.vim |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
5 source term_util.vim |
34600
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
6 source screendump.vim |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
7 |
17496
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 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
|
9 new |
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 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
|
11 2 |
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 " :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
|
13 .dl |
c8152af9fa33
patch 8.1.1746: ":dl" is seen as ":dlist" instead of ":delete"
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 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
|
15 endfunc |
17650
a1437b8f2fac
patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents:
17496
diff
changeset
|
16 |
a1437b8f2fac
patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents:
17496
diff
changeset
|
17 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
|
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 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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 normal vv |
a1437b8f2fac
patch 8.1.1822: confusing error message when range is not allowed
Bram Moolenaar <Bram@vim.org>
parents:
17496
diff
changeset
|
25 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
|
26 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
|
27 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
|
28 |
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 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
|
30 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
|
31 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
|
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(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
|
34 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
|
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(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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 |
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 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 |
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 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
|
50 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
|
51 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
|
52 endfunc |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
53 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
54 " Test for the :copy command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
55 func Test_copy() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
56 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
57 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
58 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
|
59 " 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
|
60 1,3copy 2 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
61 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
|
62 |
19625
f70a3c1000bb
patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
19471
diff
changeset
|
63 " 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
|
64 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
|
65 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
|
66 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
67 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
68 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
69 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
70 " Test for the :file command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
71 func Test_file_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
72 call assert_fails('3file', 'E474:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
73 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
|
74 call assert_fails('0file abc', 'E474:') |
24814
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
75 if !has('win32') |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
76 " Change the name of the buffer to the same name |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
77 new Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
78 file Xfile1 |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
79 call assert_equal('Xfile1', @%) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
80 call assert_equal('Xfile1', @#) |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
81 bw! |
4c5eec1ef612
patch 8.2.2945: some buffer related code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24596
diff
changeset
|
82 endif |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
83 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
84 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
85 " Test for the :drop command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
86 func Test_drop_cmd() |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
87 call writefile(['L1', 'L2'], 'Xdropfile', 'D') |
34190
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
88 " Test for reusing the current buffer |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
89 enew | only |
34190
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
90 let expected_nr = bufnr() |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
91 drop Xdropfile |
34190
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
92 call assert_equal(expected_nr, bufnr()) |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
93 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
|
94 " 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
|
95 below new |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
96 drop Xdropfile |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
97 call assert_equal(1, winnr()) |
34190
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
98 " Test for splitting the current window (set nohidden) |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
99 enew | only |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
100 set modified |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
101 drop Xdropfile |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
102 call assert_equal(2, winnr('$')) |
34190
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
103 " Not splitting the current window even if modified (set hidden) |
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
104 set hidden |
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
105 enew | only |
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
106 set modified |
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
107 drop Xdropfile |
4f8b57f8b07a
patch 9.1.0046: :drop does not re-use empty buffer
Christian Brabandt <cb@256bit.org>
parents:
33780
diff
changeset
|
108 call assert_equal(1, winnr('$')) |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
109 " Check for setting the argument list |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
110 call assert_equal(['Xdropfile'], argv()) |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
111 enew | only! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
112 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
113 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
114 " Test for the :append command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
115 func Test_append_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
116 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
117 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
118 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
|
119 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
|
120 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
121 " append after a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
126 " append with toggling 'autoindent' |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
127 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
128 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
|
129 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
|
130 call assert_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
131 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
132 " 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
|
133 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
134 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
135 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
|
136 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
|
137 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
138 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
139 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
140 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
141 |
26848
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
142 func Test_append_cmd_empty_buf() |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
143 CheckRunVimInTerminal |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
144 let lines =<< trim END |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
145 func Timer(timer) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
146 append |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
147 aaaaa |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
148 bbbbb |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
149 . |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
150 endfunc |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
151 call timer_start(10, 'Timer') |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
152 END |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
153 call writefile(lines, 'Xtest_append_cmd_empty_buf', 'D') |
26848
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
154 let buf = RunVimInTerminal('-S Xtest_append_cmd_empty_buf', {'rows': 6}) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
155 call WaitForAssert({-> assert_equal('bbbbb', term_getline(buf, 2))}) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
156 call WaitForAssert({-> assert_equal('aaaaa', term_getline(buf, 1))}) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
157 |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
158 " clean up |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
159 call StopVimInTerminal(buf) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
160 endfunc |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
161 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
162 " Test for the :insert command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
163 func Test_insert_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
164 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
165 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
166 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
|
167 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
|
168 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
169 " insert before a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
170 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
|
171 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
|
172 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
|
173 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
174 " insert with toggling 'autoindent' |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
175 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
176 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
|
177 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
|
178 call assert_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
179 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
180 " 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
|
181 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
182 call setline(1, [' L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
183 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
|
184 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
|
185 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
186 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
187 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
188 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
189 |
26848
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
190 func Test_insert_cmd_empty_buf() |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
191 CheckRunVimInTerminal |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
192 let lines =<< trim END |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
193 func Timer(timer) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
194 insert |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
195 aaaaa |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
196 bbbbb |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
197 . |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
198 endfunc |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
199 call timer_start(10, 'Timer') |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
200 END |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
201 call writefile(lines, 'Xtest_insert_cmd_empty_buf', 'D') |
26848
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
202 let buf = RunVimInTerminal('-S Xtest_insert_cmd_empty_buf', {'rows': 6}) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
203 call WaitForAssert({-> assert_equal('bbbbb', term_getline(buf, 2))}) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
204 call WaitForAssert({-> assert_equal('aaaaa', term_getline(buf, 1))}) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
205 |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
206 " clean up |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
207 call StopVimInTerminal(buf) |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
208 endfunc |
a2335ec31abc
patch 8.2.3952: first line not redrawn when adding lines to an empty buffer
Bram Moolenaar <Bram@vim.org>
parents:
26256
diff
changeset
|
209 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
210 " Test for the :change command |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
211 func Test_change_cmd() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
212 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
213 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
|
214 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
|
215 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
|
216 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
217 " change a specific line |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
218 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
|
219 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
|
220 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
|
221 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
222 " change with toggling 'autoindent' |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
223 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
|
224 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
|
225 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
|
226 call assert_false(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
227 %delete _ |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
228 " 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
|
229 set autoindent |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
230 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
|
231 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
|
232 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
|
233 call assert_true(&autoindent) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
234 set autoindent& |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
235 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
236 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
237 |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
238 " 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
|
239 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
|
240 CheckFeature multi_lang |
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_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
|
243 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
|
244 endfunc |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
245 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
246 " 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
|
247 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
|
248 CheckNotGui |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
249 CheckRunVimInTerminal |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
250 |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
251 call writefile(['foo1'], 'Xfoo', 'D') |
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
252 call writefile(['bar1'], 'Xbar', 'D') |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
253 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
254 " Test for saving all the modified buffers |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
255 let lines =<< trim END |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
256 set nomore |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
257 new Xfoo |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
258 call setline(1, 'foo2') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
259 new Xbar |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
260 call setline(1, 'bar2') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
261 wincmd b |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
262 END |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
263 call writefile(lines, 'Xscript', 'D') |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
264 let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
265 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
|
266 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
|
267 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
|
268 call StopVimInTerminal(buf) |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
269 |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
270 call assert_equal(['foo2'], readfile('Xfoo')) |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
271 call assert_equal(['bar2'], readfile('Xbar')) |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
272 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
273 " Test for discarding all the changes to modified buffers |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
274 let lines =<< trim END |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
275 set nomore |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
276 new Xfoo |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
277 call setline(1, 'foo3') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
278 new Xbar |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
279 call setline(1, 'bar3') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
280 wincmd b |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
281 END |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
282 call writefile(lines, 'Xscript') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
283 let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
284 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
|
285 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
|
286 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
|
287 call StopVimInTerminal(buf) |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
288 |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
289 call assert_equal(['foo2'], readfile('Xfoo')) |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
290 call assert_equal(['bar2'], readfile('Xbar')) |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
291 |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
292 " Test for saving and discarding changes to some buffers |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
293 let lines =<< trim END |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
294 set nomore |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
295 new Xfoo |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
296 call setline(1, 'foo4') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
297 new Xbar |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
298 call setline(1, 'bar4') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
299 wincmd b |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
300 END |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
301 call writefile(lines, 'Xscript') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
302 let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
303 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
|
304 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
|
305 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
|
306 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
|
307 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
|
308 call StopVimInTerminal(buf) |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
309 |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
310 call assert_equal(['foo4'], readfile('Xfoo')) |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
311 call assert_equal(['bar2'], readfile('Xbar')) |
19799
bde8020fb283
patch 8.2.0456: Test_confirm_cmd is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19754
diff
changeset
|
312 endfunc |
bde8020fb283
patch 8.2.0456: Test_confirm_cmd is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19754
diff
changeset
|
313 |
bde8020fb283
patch 8.2.0456: Test_confirm_cmd is flaky
Bram Moolenaar <Bram@vim.org>
parents:
19754
diff
changeset
|
314 func Test_confirm_cmd_cancel() |
19803
71911b1dc3f9
patch 8.2.0458: missing feature check in test function
Bram Moolenaar <Bram@vim.org>
parents:
19799
diff
changeset
|
315 CheckNotGui |
71911b1dc3f9
patch 8.2.0458: missing feature check in test function
Bram Moolenaar <Bram@vim.org>
parents:
19799
diff
changeset
|
316 CheckRunVimInTerminal |
71911b1dc3f9
patch 8.2.0458: missing feature check in test function
Bram Moolenaar <Bram@vim.org>
parents:
19799
diff
changeset
|
317 |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
318 " Test for closing a window with a modified buffer |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
319 let lines =<< trim END |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
320 set nomore |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
321 new |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
322 call setline(1, 'abc') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
323 END |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
324 call writefile(lines, 'Xscript', 'D') |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
325 let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
326 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
|
327 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
|
328 \ 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
|
329 call term_sendkeys(buf, "C") |
19828
2dc8d3e6993e
patch 8.2.0470: Test_confirm_cmd_cancel() can fail on a slow system
Bram Moolenaar <Bram@vim.org>
parents:
19809
diff
changeset
|
330 call WaitForAssert({-> assert_equal('', term_getline(buf, 20))}, 1000) |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
331 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
|
332 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
|
333 \ 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
|
334 call term_sendkeys(buf, "N") |
19809
c110bb3b15a8
patch 8.2.0461: confirm test fails on amd64 system
Bram Moolenaar <Bram@vim.org>
parents:
19803
diff
changeset
|
335 call WaitForAssert({-> assert_match('^ *0,0-1 All$', |
c110bb3b15a8
patch 8.2.0461: confirm test fails on amd64 system
Bram Moolenaar <Bram@vim.org>
parents:
19803
diff
changeset
|
336 \ term_getline(buf, 20))}, 1000) |
19435
8f8a5a15d00a
patch 8.2.0275: some Ex code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
337 call StopVimInTerminal(buf) |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
338 endfunc |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
339 |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
340 " The ":confirm" prompt was sometimes used with the terminal in cooked mode. |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
341 " This test verifies that a "\<CR>" character is NOT required to respond to a |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
342 " prompt from the ":conf q" and ":conf wq" commands. |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
343 func Test_confirm_q_wq() |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
344 CheckNotGui |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
345 CheckRunVimInTerminal |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
346 |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
347 call writefile(['foo'], 'Xfoo', 'D') |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
348 |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
349 let lines =<< trim END |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
350 set hidden nomore |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
351 call setline(1, 'abc') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
352 edit Xfoo |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
353 END |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
354 call writefile(lines, 'Xscript', 'D') |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
355 let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
356 call term_sendkeys(buf, ":confirm q\n") |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
357 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
358 \ term_getline(buf, 20))}, 1000) |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
359 call term_sendkeys(buf, 'C') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
360 call WaitForAssert({-> assert_notmatch('^\[Y\]es, (N)o, (C)ancel: C*$', |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
361 \ term_getline(buf, 20))}, 1000) |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
362 |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
363 call term_sendkeys(buf, ":edit Xfoo\n") |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
364 call term_sendkeys(buf, ":confirm wq\n") |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
365 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
366 \ term_getline(buf, 20))}, 1000) |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
367 call term_sendkeys(buf, 'C') |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
368 call WaitForAssert({-> assert_notmatch('^\[Y\]es, (N)o, (C)ancel: C*$', |
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
369 \ term_getline(buf, 20))}, 1000) |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
370 |
21192
0016cba920ef
patch 8.2.1147: :confirm may happen in cooked mode
Bram Moolenaar <Bram@vim.org>
parents:
21020
diff
changeset
|
371 call StopVimInTerminal(buf) |
19289
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
372 endfunc |
2f0f308c069c
patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
373 |
24572
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
374 func Test_confirm_write_ro() |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
375 CheckNotGui |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
376 CheckRunVimInTerminal |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
377 |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
378 call writefile(['foo'], 'Xconfirm_write_ro', 'D') |
24572
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
379 let lines =<< trim END |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
380 set nobackup ff=unix cmdheight=2 |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
381 edit Xconfirm_write_ro |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
382 norm Abar |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
383 END |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
384 call writefile(lines, 'Xscript', 'D') |
24572
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
385 let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
386 |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
387 " Try to write with 'ro' option. |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
388 call term_sendkeys(buf, ":set ro | confirm w\n") |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
389 call WaitForAssert({-> assert_match("^'readonly' option is set for \"Xconfirm_write_ro\"\. *$", |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
390 \ term_getline(buf, 18))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
391 call WaitForAssert({-> assert_match('^Do you wish to write anyway? *$', |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
392 \ term_getline(buf, 19))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
393 call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
394 call term_sendkeys(buf, 'N') |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
395 call WaitForAssert({-> assert_match('^ *$', term_getline(buf, 19))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
396 call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
397 call assert_equal(['foo'], readfile('Xconfirm_write_ro')) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
398 |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
399 call term_sendkeys(buf, ":confirm w\n") |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
400 call WaitForAssert({-> assert_match("^'readonly' option is set for \"Xconfirm_write_ro\"\. *$", |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
401 \ term_getline(buf, 18))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
402 call WaitForAssert({-> assert_match('^Do you wish to write anyway? *$', |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
403 \ term_getline(buf, 19))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
404 call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
405 call term_sendkeys(buf, 'Y') |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
406 call WaitForAssert({-> assert_match('^"Xconfirm_write_ro" 1L, 7B written$', |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
407 \ term_getline(buf, 19))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
408 call assert_equal(['foobar'], readfile('Xconfirm_write_ro')) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
409 |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
410 " Try to write with read-only file permissions. |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
411 call setfperm('Xconfirm_write_ro', 'r--r--r--') |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
412 call term_sendkeys(buf, ":set noro | undo | confirm w\n") |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
413 call WaitForAssert({-> assert_match("^File permissions of \"Xconfirm_write_ro\" are read-only\. *$", |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
414 \ term_getline(buf, 17))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
415 call WaitForAssert({-> assert_match('^It may still be possible to write it\. *$', |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
416 \ term_getline(buf, 18))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
417 call WaitForAssert({-> assert_match('^Do you wish to try? *$', term_getline(buf, 19))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
418 call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', term_getline(buf, 20))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
419 call term_sendkeys(buf, 'Y') |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
420 call WaitForAssert({-> assert_match('^"Xconfirm_write_ro" 1L, 4B written$', |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
421 \ term_getline(buf, 19))}, 1000) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
422 call assert_equal(['foo'], readfile('Xconfirm_write_ro')) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
423 |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
424 call StopVimInTerminal(buf) |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
425 endfunc |
dcb3a856f515
patch 8.2.2825: code in checkreadonly() not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24172
diff
changeset
|
426 |
25569
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
427 func Test_confirm_write_partial_file() |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
428 CheckNotGui |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
429 CheckRunVimInTerminal |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
430 |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
431 call writefile(['a', 'b', 'c', 'd'], 'Xwrite_partial', 'D') |
25569
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
432 call writefile(['set nobackup ff=unix cmdheight=2', |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
433 \ 'edit Xwrite_partial'], 'Xscript', 'D') |
25569
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
434 let buf = RunVimInTerminal('-S Xscript', {'rows': 20}) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
435 |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
436 call term_sendkeys(buf, ":confirm 2,3w\n") |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
437 call WaitForAssert({-> assert_match('^Write partial file? *$', |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
438 \ term_getline(buf, 19))}, 1000) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
439 call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
440 \ term_getline(buf, 20))}, 1000) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
441 call term_sendkeys(buf, 'N') |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
442 call WaitForAssert({-> assert_match('.* All$', term_getline(buf, 20))}, 1000) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
443 call assert_equal(['a', 'b', 'c', 'd'], readfile('Xwrite_partial')) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
444 call delete('Xwrite_partial') |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
445 |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
446 call term_sendkeys(buf, ":confirm 2,3w\n") |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
447 call WaitForAssert({-> assert_match('^Write partial file? *$', |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
448 \ term_getline(buf, 19))}, 1000) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
449 call WaitForAssert({-> assert_match('^(Y)es, \[N\]o: *$', |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
450 \ term_getline(buf, 20))}, 1000) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
451 call term_sendkeys(buf, 'Y') |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
452 call WaitForAssert({-> assert_match('^"Xwrite_partial" \[New\] 2L, 4B written *$', |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
453 \ term_getline(buf, 19))}, 1000) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
454 call WaitForAssert({-> assert_match('^Press ENTER or type command to continue *$', |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
455 \ term_getline(buf, 20))}, 1000) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
456 call assert_equal(['b', 'c'], readfile('Xwrite_partial')) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
457 |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
458 call StopVimInTerminal(buf) |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
459 endfunc |
8e9886ce88b3
patch 8.2.3321: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
24914
diff
changeset
|
460 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
461 " 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
|
462 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
|
463 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
|
464 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
465 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
466 " 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
|
467 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
|
468 call assert_fails('winsize 1', 'E465:') |
23855
a7098bc3810e
patch 8.2.2469: confusing error if :winsize has a wrong argument
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
469 call assert_fails('winsize 1 x', 'E465:') |
a7098bc3810e
patch 8.2.2469: confusing error if :winsize has a wrong argument
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
470 call assert_fails('win_getid(1)', 'E475: Invalid argument: _getid(1)') |
a7098bc3810e
patch 8.2.2469: confusing error if :winsize has a wrong argument
Bram Moolenaar <Bram@vim.org>
parents:
21265
diff
changeset
|
471 " Actually changing the window size would be flaky. |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
472 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
473 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
474 " Test for the :redir command |
24057
eeb5518a37aa
patch 8.2.2570: tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
23855
diff
changeset
|
475 " NOTE: if you run tests as root this will fail. Don't run tests as root! |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
476 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
|
477 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
|
478 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
|
479 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
|
480 call assert_fails('redir => a b', 'E488:') |
21265
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21192
diff
changeset
|
481 call assert_fails('redir => abc[1]', 'E121:') |
6a4806e326dd
patch 8.2.1183: assert_fails() checks the last error message
Bram Moolenaar <Bram@vim.org>
parents:
21192
diff
changeset
|
482 let b = 0zFF |
19689
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
483 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
|
484 unlet b |
da98d2ed8dc5
patch 8.2.0401: not enough test coverage for evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
19625
diff
changeset
|
485 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
486 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
|
487 " Redirecting to a directory name |
29970
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29487
diff
changeset
|
488 call mkdir('Xredir') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29487
diff
changeset
|
489 call assert_fails('redir > Xredir', 'E17:') |
d891115c0aea
patch 9.0.0323: using common name in tests leads to flaky tests
Bram Moolenaar <Bram@vim.org>
parents:
29487
diff
changeset
|
490 call delete('Xredir', 'd') |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
491 endif |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
492 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
493 " 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
|
494 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
|
495 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
|
496 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
|
497 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
498 " 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
|
499 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
|
500 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
|
501 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
|
502 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
503 |
24164
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
504 func Test_redir_cmd_readonly() |
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
505 CheckNotRoot |
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
506 |
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
507 " Redirecting to a read-only file |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
508 call writefile([], 'Xredirfile', 'D') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
509 call setfperm('Xredirfile', 'r--r--r--') |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
510 call assert_fails('redir! > Xredirfile', 'E190:') |
24164
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
511 endfunc |
2259c73cc1d9
patch 8.2.2623: some tests fail when run as root
Bram Moolenaar <Bram@vim.org>
parents:
24057
diff
changeset
|
512 |
19370
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
513 " 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
|
514 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
|
515 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
|
516 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
517 |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
518 " 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
|
519 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
|
520 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
|
521 endfunc |
02111977dd05
patch 8.2.0243: insufficient code coverage for ex_docmd.c functions
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
522 |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
523 " 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
|
524 func Test_sleep_cmd() |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
525 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
|
526 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
527 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
528 " 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
|
529 func Test_read_cmd() |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
530 call writefile(['one'], 'Xcmdfile', 'D') |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
531 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
532 call assert_fails('read', 'E32:') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
533 edit Xcmdfile |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
534 read |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
535 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
|
536 close! |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
537 new |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
538 read Xcmdfile |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
539 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
|
540 call deletebufline('', 1, '$') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
541 call feedkeys("Qr Xcmdfile\<CR>visual\<CR>", 'xt') |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
542 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
|
543 close! |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
544 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
545 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
546 " 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
|
547 " <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
|
548 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
|
549 " :quit |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
550 let cmd = ":\<C-\>eexecute('quit')\<CR>\<C-C>" |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
551 call assert_fails("call feedkeys(cmd, 'xt')", 'E565:') |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
552 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
553 " :qall |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
554 let cmd = ":\<C-\>eexecute('qall')\<CR>\<C-C>" |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
555 call assert_fails("call feedkeys(cmd, 'xt')", 'E565:') |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
556 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
557 " :exit |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
558 let cmd = ":\<C-\>eexecute('exit')\<CR>\<C-C>" |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
559 call assert_fails("call feedkeys(cmd, 'xt')", 'E565:') |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
560 |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
561 " :close - should be ignored |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
562 new |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
563 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
|
564 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
|
565 close |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
566 |
20118
252d2bb90394
patch 8.2.0614: get ml_get error when deleting a line in 'completefunc'
Bram Moolenaar <Bram@vim.org>
parents:
19852
diff
changeset
|
567 call assert_fails("call feedkeys(\":\<C-R>=execute('bnext')\<CR>\", 'xt')", 'E565:') |
21020
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
568 |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
569 " :tabfirst |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
570 tabnew |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
571 call assert_fails("call feedkeys(\":\<C-R>=execute('tabfirst')\<CR>\", 'xt')", 'E565:') |
6c634e63989c
patch 8.2.1061: insufficient testing for src/window.c
Bram Moolenaar <Bram@vim.org>
parents:
20118
diff
changeset
|
572 tabclose |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
573 endfunc |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
574 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
575 " 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
|
576 func Test_verbose_cmd() |
28433
367439b95aba
patch 8.2.4741: startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
27072
diff
changeset
|
577 set verbose=3 |
367439b95aba
patch 8.2.4741: startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
27072
diff
changeset
|
578 call assert_match(' verbose=1\n\s*Last set from ', execute('verbose set vbs'), "\n") |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
579 call assert_equal([' verbose=0'], split(execute('0verbose set vbs'), "\n")) |
28433
367439b95aba
patch 8.2.4741: startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
27072
diff
changeset
|
580 set verbose=0 |
367439b95aba
patch 8.2.4741: startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
27072
diff
changeset
|
581 call assert_match(' verbose=4\n\s*Last set from .*\n verbose=0', |
367439b95aba
patch 8.2.4741: startup test fails
Bram Moolenaar <Bram@vim.org>
parents:
27072
diff
changeset
|
582 \ execute("4verbose set verbose | set verbose")) |
19471
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
583 endfunc |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
584 |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
585 " 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
|
586 func Test_excmd_delete() |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
587 new |
cb73f4ae6b7c
patch 8.2.0293: various Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19435
diff
changeset
|
588 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
|
589 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 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
|
595 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
|
596 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
|
597 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
|
598 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
|
599 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
|
600 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
|
601 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
|
602 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
|
603 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
|
604 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
|
605 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
|
606 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
|
607 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
|
608 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
|
609 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
|
610 close! |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
611 endfunc |
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19370
diff
changeset
|
612 |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
613 " Test for commands that are blocked in a sandbox |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
614 func Sandbox_tests() |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
615 call assert_fails("call histadd(':', 'ls')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
616 call assert_fails("call mkdir('Xdir')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
617 call assert_fails("call rename('a', 'b')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
618 call assert_fails("call setbufvar(1, 'myvar', 1)", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
619 call assert_fails("call settabvar(1, 'myvar', 1)", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
620 call assert_fails("call settabwinvar(1, 1, 'myvar', 1)", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
621 call assert_fails("call setwinvar(1, 'myvar', 1)", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
622 call assert_fails("call timer_start(100, '')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
623 if has('channel') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
624 call assert_fails("call prompt_setcallback(1, '')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
625 call assert_fails("call prompt_setinterrupt(1, '')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
626 call assert_fails("call prompt_setprompt(1, '')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
627 endif |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
628 call assert_fails("let $TESTVAR=1", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
629 call assert_fails("call feedkeys('ivim')", 'E48:') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
630 call assert_fails("source! Xsomefile", 'E48:') |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
631 call assert_fails("call delete('Xthatfile')", 'E48:') |
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
632 call assert_fails("call writefile([], 'Xanotherfile')", 'E48:') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
633 call assert_fails('!ls', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
634 call assert_fails('shell', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
635 call assert_fails('stop', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
636 call assert_fails('exe "normal \<C-Z>"', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
637 set insertmode |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
638 call assert_fails('call feedkeys("\<C-Z>", "xt")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
639 set insertmode& |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
640 call assert_fails('suspend', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
641 call assert_fails('call system("ls")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
642 call assert_fails('call systemlist("ls")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
643 if has('clientserver') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
644 call assert_fails('let s=remote_expr("gvim", "2+2")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
645 if !has('win32') |
26211
485c7c4afeb7
patch 8.2.3637: typos in test files
Bram Moolenaar <Bram@vim.org>
parents:
25883
diff
changeset
|
646 " remote_foreground() doesn't throw an error message on MS-Windows |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
647 call assert_fails('call remote_foreground("gvim")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
648 endif |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
649 call assert_fails('let s=remote_peek("gvim")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
650 call assert_fails('let s=remote_read("gvim")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
651 call assert_fails('let s=remote_send("gvim", "abc")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
652 call assert_fails('let s=server2client("gvim", "abc")', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
653 endif |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
654 if has('terminal') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
655 call assert_fails('terminal', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
656 call assert_fails('call term_start("vim")', 'E48:') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
657 call assert_fails('call term_dumpwrite(1, "Xdumpfile")', 'E48:') |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
658 endif |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
659 if has('channel') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
660 call assert_fails("call ch_logfile('chlog')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
661 call assert_fails("call ch_open('localhost:8765')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
662 endif |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
663 if has('job') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
664 call assert_fails("call job_start('vim')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
665 endif |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
666 if has('unix') && has('libcall') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
667 call assert_fails("echo libcall('libc.so', 'getenv', 'HOME')", 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
668 endif |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
669 if has('unix') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
670 call assert_fails('cd `pwd`', 'E48:') |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
671 endif |
24882
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
672 " some options cannot be changed in a sandbox |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
673 call assert_fails('set exrc', 'E48:') |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
674 call assert_fails('set cdpath', 'E48:') |
24914
1186160ecf57
patch 8.2.2994: various code is not fully tested
Bram Moolenaar <Bram@vim.org>
parents:
24882
diff
changeset
|
675 if has('xim') && has('gui_gtk') |
24882
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
676 call assert_fails('set imstyle', 'E48:') |
4c1b6f3eb96b
patch 8.2.2979: not all options code is covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24814
diff
changeset
|
677 endif |
19852
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
678 endfunc |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
679 |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
680 func Test_sandbox() |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
681 sandbox call Sandbox_tests() |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
682 endfunc |
12518b40c161
patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19828
diff
changeset
|
683 |
24596
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24572
diff
changeset
|
684 func Test_command_not_implemented_E319() |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24572
diff
changeset
|
685 if !has('mzscheme') |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24572
diff
changeset
|
686 call assert_fails('mzscheme', 'E319:') |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24572
diff
changeset
|
687 endif |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24572
diff
changeset
|
688 endfunc |
acd9220bdd0b
patch 8.2.2837: various code lines not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
24572
diff
changeset
|
689 |
25883
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
690 func Test_not_break_expression_register() |
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
691 call setreg('=', '1+1') |
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
692 if 0 |
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
693 put =1 |
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
694 endif |
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
695 call assert_equal('1+1', getreg('=', 1)) |
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
696 endfunc |
826c36b4640b
patch 8.2.3475: expression register set by not executed put command
Bram Moolenaar <Bram@vim.org>
parents:
25569
diff
changeset
|
697 |
26256
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
698 func Test_address_line_overflow() |
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
699 if v:sizeoflong < 8 |
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
700 throw 'Skipped: only works with 64 bit long ints' |
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
701 endif |
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
702 new |
27072
0878d7c64140
patch 8.2.4065: computation overflow with large cound for :yank
Bram Moolenaar <Bram@vim.org>
parents:
26848
diff
changeset
|
703 call setline(1, range(100)) |
26256
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
704 call assert_fails('|.44444444444444444444444', 'E1247:') |
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
705 call assert_fails('|.9223372036854775806', 'E1247:') |
27072
0878d7c64140
patch 8.2.4065: computation overflow with large cound for :yank
Bram Moolenaar <Bram@vim.org>
parents:
26848
diff
changeset
|
706 |
0878d7c64140
patch 8.2.4065: computation overflow with large cound for :yank
Bram Moolenaar <Bram@vim.org>
parents:
26848
diff
changeset
|
707 $ |
0878d7c64140
patch 8.2.4065: computation overflow with large cound for :yank
Bram Moolenaar <Bram@vim.org>
parents:
26848
diff
changeset
|
708 yank 77777777777777777777 |
0878d7c64140
patch 8.2.4065: computation overflow with large cound for :yank
Bram Moolenaar <Bram@vim.org>
parents:
26848
diff
changeset
|
709 call assert_equal("99\n", @") |
0878d7c64140
patch 8.2.4065: computation overflow with large cound for :yank
Bram Moolenaar <Bram@vim.org>
parents:
26848
diff
changeset
|
710 |
26256
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
711 bwipe! |
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
712 endfunc |
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
713 |
29030
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
714 " This was leaving the cursor in line zero |
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
715 func Test_using_zero_in_range() |
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
716 new |
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
717 norm o00 |
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
718 silent! 0;s/\%') |
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
719 bwipe! |
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
720 endfunc |
f79cff615e69
patch 8.2.5037: cursor position may be invalid after "0;" range
Bram Moolenaar <Bram@vim.org>
parents:
28433
diff
changeset
|
721 |
29487
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
722 " Test :write after changing name with :file and loading it with :edit |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
723 func Test_write_after_rename() |
30405
ea38db8639eb
patch 9.0.0538: manually deleting test temp files
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
724 call writefile(['text'], 'Xafterfile', 'D') |
29487
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
725 |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
726 enew |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
29970
diff
changeset
|
727 file Xafterfile |
29487
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
728 call assert_fails('write', 'E13: File exists (add ! to override)') |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
729 |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
730 " works OK after ":edit" |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
731 edit |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
732 write |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
733 |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
734 bwipe! |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
735 endfunc |
4f52a21f41f3
patch 9.0.0085: ":write" fails after ":file name" and the ":edit"
Bram Moolenaar <Bram@vim.org>
parents:
29030
diff
changeset
|
736 |
33780
377ed6ab612c
patch 9.0.2110: [security]: overflow in ex address parsing
Christian Brabandt <cb@256bit.org>
parents:
30405
diff
changeset
|
737 " catch address lines overflow |
377ed6ab612c
patch 9.0.2110: [security]: overflow in ex address parsing
Christian Brabandt <cb@256bit.org>
parents:
30405
diff
changeset
|
738 func Test_ex_address_range_overflow() |
377ed6ab612c
patch 9.0.2110: [security]: overflow in ex address parsing
Christian Brabandt <cb@256bit.org>
parents:
30405
diff
changeset
|
739 call assert_fails(':--+foobar', 'E492:') |
377ed6ab612c
patch 9.0.2110: [security]: overflow in ex address parsing
Christian Brabandt <cb@256bit.org>
parents:
30405
diff
changeset
|
740 endfunc |
26256
92fbed13ca4d
patch 8.2.3659: integer overflow with large line number
Bram Moolenaar <Bram@vim.org>
parents:
26211
diff
changeset
|
741 |
34600
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
742 func Test_drop_modified_file() |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
743 CheckScreendump |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
744 let lines =<< trim END |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
745 call setline(1, 'The quick brown fox jumped over the lazy dogs') |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
746 END |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
747 call writefile([''], 'Xdrop_modified.txt', 'D') |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
748 call writefile(lines, 'Xtest_drop_modified', 'D') |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
749 let buf = RunVimInTerminal('-S Xtest_drop_modified Xdrop_modified.txt', {'rows': 10,'columns': 40}) |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
750 call term_sendkeys(buf, ":drop Xdrop_modified.txt\<CR>") |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
751 call VerifyScreenDump(buf, 'Test_drop_modified_1', {}) |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
752 |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
753 " clean up |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
754 call StopVimInTerminal(buf) |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
755 endfunc |
3b8ed014a445
patch 9.1.0192: drop: don't rewind when editing the same file
Christian Brabandt <cb@256bit.org>
parents:
34190
diff
changeset
|
756 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18463
diff
changeset
|
757 " vim: shiftwidth=2 sts=2 expandtab |