Skip to content

Commit c628fdc

Browse files
committed
patch 7.4.2296
Problem: No tests for :undolist and "U" command. Solution: Add tests. (Dominique Pelle)
1 parent 89bcfda commit c628fdc

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

src/testdir/test_undo.vim

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,39 @@ func Test_undo_del_chars()
129129
close!
130130
endfunc
131131

132+
func Test_undolist()
133+
new
134+
set ul=100
135+
136+
let a=execute('undolist')
137+
call assert_equal("\nNothing to undo", a)
138+
139+
" 1 leaf (2 changes).
140+
call feedkeys('achange1', 'xt')
141+
call feedkeys('achange2', 'xt')
142+
let a=execute('undolist')
143+
call assert_match("^\nnumber changes when *saved\n *2 *2 .*$", a)
144+
145+
" 2 leaves.
146+
call feedkeys('u', 'xt')
147+
call feedkeys('achange3\<Esc>', 'xt')
148+
let a=execute('undolist')
149+
call assert_match("^\nnumber changes when *saved\n *2 *2 *.*\n *3 *2 .*$", a)
150+
close!
151+
endfunc
152+
153+
func Test_U_command()
154+
new
155+
set ul=100
156+
call feedkeys("achange1\<Esc>", 'xt')
157+
call feedkeys("achange2\<Esc>", 'xt')
158+
norm! U
159+
call assert_equal('', getline(1))
160+
norm! U
161+
call assert_equal('change1change2', getline(1))
162+
close!
163+
endfunc
164+
132165
func Test_undojoin()
133166
new
134167
call feedkeys("Goaaaa\<Esc>", 'xt')

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,8 @@ static char *(features[]) =
763763

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2296,
766768
/**/
767769
2295,
768770
/**/

0 commit comments

Comments
 (0)