annotate src/testdir/test_cdo.vim @ 35308:22c03485f222 v9.1.0456

patch 9.1.0456: Left shift is incorrect with vartabstop and shiftwidth=0 Commit: https://github.com/vim/vim/commit/88d4f255b7b7a19bb4f6489e0ad0956e47d51fed Author: Gary Johnson <garyjohn@spocom.com> Date: Sat Jun 1 20:51:33 2024 +0200 patch 9.1.0456: Left shift is incorrect with vartabstop and shiftwidth=0 Problem: Left shift is incorrect with vartabstop and shiftwidth=0 Solution: make tabstop_at() function aware of shift direction (Gary Johnson) The problem was that with 'vartabstop' set and 'shiftwidth' equal 0, left shifts using << were shifting the line to the wrong column. The tabstop to the right of the first character in the line was being used as the shift amount instead of the tabstop to the left of that first character. The reason was that the tabstop_at() function always returned the value of the tabstop to the right of the given column and was not accounting for the direction of the shift. The solution was to make tabstop_at() aware of the direction of the shift and to choose the tabtop accordingly. A test was added to check this behavior and make sure it doesn't regress. While at it, also fix a few indentation/alignment issues. fixes: #14864 closes: #14887 Signed-off-by: Gary Johnson <garyjohn@spocom.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 01 Jun 2024 21:00:03 +0200
parents 5788b78a1af0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for the :cdo, :cfdo, :ldo and :lfdo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
3 source check.vim
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16965
diff changeset
4 CheckFeature quickfix
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " Create the files used by the tests
20003
e373843e2980 patch 8.2.0557: no IPv6 support for channels
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
7 func SetUp()
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile1')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile2')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call writefile(["Line1", "Line2", "Line3"], 'Xtestfile3')
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
11 endfunc
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " Remove the files used by the tests
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
14 func TearDown()
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call delete('Xtestfile1')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call delete('Xtestfile2')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 call delete('Xtestfile3')
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
18 endfunc
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " Returns the current line in '<filename> <linenum>L <column>C' format
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
21 func GetRuler()
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 return expand('%') . ' ' . line('.') . 'L' . ' ' . col('.') . 'C'
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
23 endfunc
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 " Tests for the :cdo and :ldo commands
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
26 func XdoTests(cchar)
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " Shortcuts for calling the cdo and ldo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 let Xdo = a:cchar . 'do'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 let Xgetexpr = a:cchar . 'getexpr'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 let Xprev = a:cchar. 'prev'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 let XdoCmd = Xdo . ' call add(l, GetRuler())'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " Try with an empty list
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " Populate the list and then try
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:3:1:Line3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 " Run command only on selected error lines
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 exe "2,3" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 " Boundary condition tests
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 exe "1,1" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 call assert_equal(['Xtestfile1 1L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 exe "3" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 call assert_equal(['Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 " Range test commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 exe "%" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 exe "1,$" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 exe Xprev
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 exe "." . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 call assert_equal(['Xtestfile2 2L 2C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 exe "+" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 call assert_equal(['Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 " Invalid error lines test
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 exe "silent! 27" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 exe "silent! 4,5" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 " Run commands from an unsaved buffer
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 let v:errmsg=''
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 setlocal modified
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 exe "silent! 2,2" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 if v:errmsg !~# 'No write since last change'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 call add(v:errors, 'Unsaved file change test failed')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 endif
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103 " If the executed command fails, then the operation should be aborted
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 enew!
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 let subst_count = 0
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 exe "silent!" . Xdo . " s/Line/xLine/ | let subst_count += 1"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 if subst_count != 1 || getline('.') != 'xLine1'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 call add(v:errors, 'Abort command on error test failed')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 endif
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 exe "2,2" . Xdo . "! call add(l, GetRuler())"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 call assert_equal(['Xtestfile2 2L 2C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 " List with no valid error entries
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 edit! +2 Xtestfile1
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 exe Xgetexpr . " ['non-error 1', 'non-error 2', 'non-error 3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 exe "silent! 2" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 let v:errmsg=''
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 exe "%" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 exe "1,$" . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 exe "." . XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 call assert_equal('', v:errmsg)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 " List with only one valid entry
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 exe Xgetexpr . " ['Xtestfile3:3:1:Line3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 exe XdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 call assert_equal(['Xtestfile3 3L 1C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
135 endfunc
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 " Tests for the :cfdo and :lfdo commands
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
138 func XfdoTests(cchar)
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 enew
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 " Shortcuts for calling the cfdo and lfdo commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 let Xfdo = a:cchar . 'fdo'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 let Xgetexpr = a:cchar . 'getexpr'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 let XfdoCmd = Xfdo . ' call add(l, GetRuler())'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 let Xpfile = a:cchar. 'pfile'
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 " Clear the quickfix/location list
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 exe Xgetexpr . " []"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 " Try with an empty list
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 exe XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 call assert_equal([], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155 " Populate the list and then try
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 exe Xgetexpr . " ['non-error 1', 'Xtestfile1:1:3:Line1', 'Xtestfile1:2:1:Line2', 'non-error 2', 'Xtestfile2:2:2:Line2', 'non-error 3', 'Xtestfile3:2:3:Line2', 'Xtestfile3:3:1:Line3']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 exe XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 " Run command only on selected error lines
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 exe "2,3" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 call assert_equal(['Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 " Boundary condition tests
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 exe "3" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 call assert_equal(['Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 " Range test commands
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 exe "%" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 exe "1,$" . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 call assert_equal(['Xtestfile1 1L 3C', 'Xtestfile2 2L 2C', 'Xtestfile3 2L 3C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 exe Xpfile
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 exe "." . XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 call assert_equal(['Xtestfile2 2L 2C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 " List with only one valid entry
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 let l = []
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 exe Xgetexpr . " ['Xtestfile2:2:5:Line2']"
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 exe XfdoCmd
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 call assert_equal(['Xtestfile2 2L 5C'], l)
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
192 endfunc
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 " Tests for cdo and cfdo
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
195 func Test_cdo()
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 call XdoTests('c')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 call XfdoTests('c')
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
198 endfunc
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 " Tests for ldo and lfdo
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
201 func Test_ldo()
7350
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 call XdoTests('l')
5ac8ee7bf4ff commit https://github.com/vim/vim/commit/57d7971b5f1621071176eea81cdb0d1fc50c925d
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 call XfdoTests('l')
20565
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
204 endfunc
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
205
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
206 " Test for making 'shm' doesn't interfere with the output.
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
207 func Test_cdo_print()
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
208 enew | only!
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
209 cgetexpr ["Xtestfile1:1:Line1", "Xtestfile2:1:Line1", "Xtestfile3:1:Line1"]
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
210 cdo print
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
211 call assert_equal('Line1', Screenline(&lines))
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
212 call assert_equal('Line1', Screenline(&lines - 3))
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
213 call assert_equal('Line1', Screenline(&lines - 6))
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
214 endfunc
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
215
5788b78a1af0 patch 8.2.0836: not all :cdo output is visible
Bram Moolenaar <Bram@vim.org>
parents: 20003
diff changeset
216 " vim: shiftwidth=2 sts=2 expandtab