vim-patch:8.2.0008: test72 is old style
Problem: Test72 is old style.
Solution: Convert to new style test. (Yegappan Lakshmanan, closes vim/vim#5362)
3e2d1c8cd6
This commit is contained in:
parent
63cd5dd0ae
commit
06f37709e7
|
@ -443,3 +443,190 @@ func Test_undo_0()
|
|||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Tests for the undo file
|
||||
" Explicitly break changes up in undo-able pieces by setting 'undolevels'.
|
||||
func Test_undofile_2()
|
||||
set undolevels=100 undofile
|
||||
edit Xtestfile
|
||||
call append(0, 'this is one line')
|
||||
call cursor(1, 1)
|
||||
|
||||
" first a simple one-line change.
|
||||
set undolevels=100
|
||||
s/one/ONE/
|
||||
set undolevels=100
|
||||
write
|
||||
bwipe!
|
||||
edit Xtestfile
|
||||
undo
|
||||
call assert_equal('this is one line', getline(1))
|
||||
|
||||
" change in original file fails check
|
||||
set noundofile
|
||||
edit! Xtestfile
|
||||
s/line/Line/
|
||||
write
|
||||
set undofile
|
||||
bwipe!
|
||||
edit Xtestfile
|
||||
undo
|
||||
call assert_equal('this is ONE Line', getline(1))
|
||||
|
||||
" add 10 lines, delete 6 lines, undo 3
|
||||
set undofile
|
||||
call setbufline(0, 1, ['one', 'two', 'three', 'four', 'five', 'six',
|
||||
\ 'seven', 'eight', 'nine', 'ten'])
|
||||
set undolevels=100
|
||||
normal 3Gdd
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
write
|
||||
bwipe!
|
||||
edit Xtestfile
|
||||
normal uuu
|
||||
call assert_equal(['one', 'two', 'six', 'seven', 'eight', 'nine', 'ten'],
|
||||
\ getline(1, '$'))
|
||||
|
||||
" Test that reading the undofiles when setting undofile works
|
||||
set noundofile undolevels=0
|
||||
exe "normal i\n"
|
||||
undo
|
||||
edit! Xtestfile
|
||||
set undofile undolevels=100
|
||||
normal uuuuuu
|
||||
call assert_equal(['one', 'two', 'three', 'four', 'five', 'six', 'seven',
|
||||
\ 'eight', 'nine', 'ten'], getline(1, '$'))
|
||||
|
||||
bwipe!
|
||||
call delete('Xtestfile')
|
||||
let ufile = has('vms') ? '_un_Xtestfile' : '.Xtestfile.un~'
|
||||
call delete(ufile)
|
||||
set undofile& undolevels&
|
||||
endfunc
|
||||
|
||||
" Test 'undofile' using a file encrypted with 'zip' crypt method
|
||||
func Test_undofile_cryptmethod_zip()
|
||||
throw 'skipped: Nvim does not support cryptmethod'
|
||||
edit Xtestfile
|
||||
set undofile cryptmethod=zip
|
||||
call append(0, ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'])
|
||||
call cursor(5, 1)
|
||||
|
||||
set undolevels=100
|
||||
normal kkkdd
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
" encrypt the file using key 'foobar'
|
||||
call feedkeys("foobar\nfoobar\n")
|
||||
X
|
||||
write!
|
||||
bwipe!
|
||||
|
||||
call feedkeys("foobar\n")
|
||||
edit Xtestfile
|
||||
set key=
|
||||
normal uu
|
||||
call assert_equal(['monday', 'wednesday', 'thursday', 'friday', ''],
|
||||
\ getline(1, '$'))
|
||||
|
||||
bwipe!
|
||||
call delete('Xtestfile')
|
||||
let ufile = has('vms') ? '_un_Xtestfile' : '.Xtestfile.un~'
|
||||
call delete(ufile)
|
||||
set undofile& undolevels& cryptmethod&
|
||||
endfunc
|
||||
|
||||
" Test 'undofile' using a file encrypted with 'blowfish' crypt method
|
||||
func Test_undofile_cryptmethod_blowfish()
|
||||
throw 'skipped: Nvim does not support cryptmethod'
|
||||
edit Xtestfile
|
||||
set undofile cryptmethod=blowfish
|
||||
call append(0, ['jan', 'feb', 'mar', 'apr', 'jun'])
|
||||
call cursor(5, 1)
|
||||
|
||||
set undolevels=100
|
||||
exe 'normal kk0ifoo '
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
exe 'normal ibar '
|
||||
set undolevels=100
|
||||
" encrypt the file using key 'foobar'
|
||||
call feedkeys("foobar\nfoobar\n")
|
||||
X
|
||||
write!
|
||||
bwipe!
|
||||
|
||||
call feedkeys("foobar\n")
|
||||
edit Xtestfile
|
||||
set key=
|
||||
call search('bar')
|
||||
call assert_equal('bar apr', getline('.'))
|
||||
undo
|
||||
call assert_equal('apr', getline('.'))
|
||||
undo
|
||||
call assert_equal('foo mar', getline('.'))
|
||||
undo
|
||||
call assert_equal('mar', getline('.'))
|
||||
|
||||
bwipe!
|
||||
call delete('Xtestfile')
|
||||
let ufile = has('vms') ? '_un_Xtestfile' : '.Xtestfile.un~'
|
||||
call delete(ufile)
|
||||
set undofile& undolevels& cryptmethod&
|
||||
endfunc
|
||||
|
||||
" Test 'undofile' using a file encrypted with 'blowfish2' crypt method
|
||||
func Test_undofile_cryptmethod_blowfish2()
|
||||
throw 'skipped: Nvim does not support cryptmethod'
|
||||
edit Xtestfile
|
||||
set undofile cryptmethod=blowfish2
|
||||
call append(0, ['jan', 'feb', 'mar', 'apr', 'jun'])
|
||||
call cursor(5, 1)
|
||||
|
||||
set undolevels=100
|
||||
exe 'normal kk0ifoo '
|
||||
set undolevels=100
|
||||
normal dd
|
||||
set undolevels=100
|
||||
exe 'normal ibar '
|
||||
set undolevels=100
|
||||
" encrypt the file using key 'foo2bar'
|
||||
call feedkeys("foo2bar\nfoo2bar\n")
|
||||
X
|
||||
write!
|
||||
bwipe!
|
||||
|
||||
call feedkeys("foo2bar\n")
|
||||
edit Xtestfile
|
||||
set key=
|
||||
call search('bar')
|
||||
call assert_equal('bar apr', getline('.'))
|
||||
normal u
|
||||
call assert_equal('apr', getline('.'))
|
||||
normal u
|
||||
call assert_equal('foo mar', getline('.'))
|
||||
normal u
|
||||
call assert_equal('mar', getline('.'))
|
||||
|
||||
bwipe!
|
||||
call delete('Xtestfile')
|
||||
let ufile = has('vms') ? '_un_Xtestfile' : '.Xtestfile.un~'
|
||||
call delete(ufile)
|
||||
set undofile& undolevels& cryptmethod&
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
|
Loading…
Reference in New Issue