Mercurial > vim
comparison src/testdir/test_cdo.vim @ 20565:5788b78a1af0 v8.2.0836
patch 8.2.0836: not all :cdo output is visible
Commit: https://github.com/vim/vim/commit/14798ab9a5ee4b94f6c12f1986207569356acfc8
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu May 28 21:30:11 2020 +0200
patch 8.2.0836: not all :cdo output is visible
Problem: Not all :cdo output is visible.
Solution: Reset 'shortmess' temporarily. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6155)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 28 May 2020 21:45:03 +0200 |
parents | e373843e2980 |
children |
comparison
equal
deleted
inserted
replaced
20564:63370fc0b915 | 20565:5788b78a1af0 |
---|---|
6 " Create the files used by the tests | 6 " Create the files used by the tests |
7 func SetUp() | 7 func SetUp() |
8 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1') | 8 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1') |
9 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2') | 9 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2') |
10 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3') | 10 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3') |
11 endfunction | 11 endfunc |
12 | 12 |
13 " Remove the files used by the tests | 13 " Remove the files used by the tests |
14 function TearDown() | 14 func TearDown() |
15 call delete('Xtestfile1') | 15 call delete('Xtestfile1') |
16 call delete('Xtestfile2') | 16 call delete('Xtestfile2') |
17 call delete('Xtestfile3') | 17 call delete('Xtestfile3') |
18 endfunction | 18 endfunc |
19 | 19 |
20 " Returns the current line in '<filename> <linenum>L <column>C' format | 20 " Returns the current line in '<filename> <linenum>L <column>C' format |
21 function GetRuler() | 21 func GetRuler() |
22 return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' | 22 return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C' |
23 endfunction | 23 endfunc |
24 | 24 |
25 " Tests for the :cdo and :ldo commands | 25 " Tests for the :cdo and :ldo commands |
26 function XdoTests(cchar) | 26 func XdoTests(cchar) |
27 enew | 27 enew |
28 | 28 |
29 " Shortcuts for calling the cdo and ldo commands | 29 " Shortcuts for calling the cdo and ldo commands |
30 let Xdo = a:cchar . 'do' | 30 let Xdo = a:cchar . 'do' |
31 let Xgetexpr = a:cchar . 'getexpr' | 31 let Xgetexpr = a:cchar . 'getexpr' |
130 let l = [] | 130 let l = [] |
131 exe Xgetexpr . " ['Xtestfile3:3:1:Line3']" | 131 exe Xgetexpr . " ['Xtestfile3:3:1:Line3']" |
132 exe XdoCmd | 132 exe XdoCmd |
133 call assert_equal(['Xtestfile3 3L 1C'], l) | 133 call assert_equal(['Xtestfile3 3L 1C'], l) |
134 | 134 |
135 endfunction | 135 endfunc |
136 | 136 |
137 " Tests for the :cfdo and :lfdo commands | 137 " Tests for the :cfdo and :lfdo commands |
138 function XfdoTests(cchar) | 138 func XfdoTests(cchar) |
139 enew | 139 enew |
140 | 140 |
141 " Shortcuts for calling the cfdo and lfdo commands | 141 " Shortcuts for calling the cfdo and lfdo commands |
142 let Xfdo = a:cchar . 'fdo' | 142 let Xfdo = a:cchar . 'fdo' |
143 let Xgetexpr = a:cchar . 'getexpr' | 143 let Xgetexpr = a:cchar . 'getexpr' |
187 let l = [] | 187 let l = [] |
188 exe Xgetexpr . " ['Xtestfile2:2:5:Line2']" | 188 exe Xgetexpr . " ['Xtestfile2:2:5:Line2']" |
189 exe XfdoCmd | 189 exe XfdoCmd |
190 call assert_equal(['Xtestfile2 2L 5C'], l) | 190 call assert_equal(['Xtestfile2 2L 5C'], l) |
191 | 191 |
192 endfunction | 192 endfunc |
193 | 193 |
194 " Tests for cdo and cfdo | 194 " Tests for cdo and cfdo |
195 function Test_cdo() | 195 func Test_cdo() |
196 call XdoTests('c') | 196 call XdoTests('c') |
197 call XfdoTests('c') | 197 call XfdoTests('c') |
198 endfunction | 198 endfunc |
199 | 199 |
200 " Tests for ldo and lfdo | 200 " Tests for ldo and lfdo |
201 function Test_ldo() | 201 func Test_ldo() |
202 call XdoTests('l') | 202 call XdoTests('l') |
203 call XfdoTests('l') | 203 call XfdoTests('l') |
204 endfunction | 204 endfunc |
205 | |
206 " Test for making 'shm' doesn't interfere with the output. | |
207 func Test_cdo_print() | |
208 enew | only! | |
209 cgetexpr ["Xtestfile1:1:Line1", "Xtestfile2:1:Line1", "Xtestfile3:1:Line1"] | |
210 cdo print | |
211 call assert_equal('Line1', Screenline(&lines)) | |
212 call assert_equal('Line1', Screenline(&lines - 3)) | |
213 call assert_equal('Line1', Screenline(&lines - 6)) | |
214 endfunc | |
215 | |
216 " vim: shiftwidth=2 sts=2 expandtab |