mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 05:48:17 +00:00
Merge PR #1993 'legacy test: migrate test 72'
This commit is contained in:
@@ -1,69 +0,0 @@
|
|||||||
Tests for undo file.
|
|
||||||
Since this script is sourced we need to explicitly break changes up in
|
|
||||||
undo-able pieces. Do that by setting 'undolevels'.
|
|
||||||
|
|
||||||
STARTTEST
|
|
||||||
:so small.vim
|
|
||||||
:"
|
|
||||||
:" Test 'undofile': first a simple one-line change.
|
|
||||||
:set visualbell
|
|
||||||
:set ul=100 undofile nomore
|
|
||||||
:e! Xtestfile
|
|
||||||
ggdGithis is one line:set ul=100
|
|
||||||
:s/one/ONE/
|
|
||||||
:set ul=100
|
|
||||||
:w
|
|
||||||
:bwipe!
|
|
||||||
:e Xtestfile
|
|
||||||
u:.w! test.out
|
|
||||||
:"
|
|
||||||
:" Test 'undofile', change in original file fails check
|
|
||||||
:set noundofile
|
|
||||||
:e! Xtestfile
|
|
||||||
:s/line/Line/
|
|
||||||
:w
|
|
||||||
:set undofile
|
|
||||||
:bwipe!
|
|
||||||
:e Xtestfile
|
|
||||||
:" TODO: this beeps
|
|
||||||
u:.w >>test.out
|
|
||||||
:"
|
|
||||||
:" Test 'undofile', add 10 lines, delete 6 lines, undo 3
|
|
||||||
:set undofile
|
|
||||||
ggdGione
|
|
||||||
two
|
|
||||||
three
|
|
||||||
four
|
|
||||||
five
|
|
||||||
six
|
|
||||||
seven
|
|
||||||
eight
|
|
||||||
nine
|
|
||||||
ten:set ul=100
|
|
||||||
3Gdd:set ul=100
|
|
||||||
dd:set ul=100
|
|
||||||
dd:set ul=100
|
|
||||||
dd:set ul=100
|
|
||||||
dd:set ul=100
|
|
||||||
dd:set ul=100
|
|
||||||
:w
|
|
||||||
:bwipe!
|
|
||||||
:e Xtestfile
|
|
||||||
uuu:w >>test.out
|
|
||||||
:"
|
|
||||||
:" Test that reading the undofiles when setting undofile works
|
|
||||||
:set noundofile ul=0
|
|
||||||
i
|
|
||||||
u:e! Xtestfile
|
|
||||||
:set undofile ul=100
|
|
||||||
uuuuuu:w >>test.out
|
|
||||||
:"
|
|
||||||
:" Rename the undo file so that it gets cleaned up.
|
|
||||||
:call rename(".Xtestfile.un~", "Xtestundo")
|
|
||||||
:qa!
|
|
||||||
ENDTEST
|
|
||||||
|
|
||||||
1111 -----
|
|
||||||
2222 -----
|
|
||||||
|
|
||||||
123456789
|
|
@@ -1,19 +0,0 @@
|
|||||||
this is one line
|
|
||||||
this is ONE Line
|
|
||||||
one
|
|
||||||
two
|
|
||||||
six
|
|
||||||
seven
|
|
||||||
eight
|
|
||||||
nine
|
|
||||||
ten
|
|
||||||
one
|
|
||||||
two
|
|
||||||
three
|
|
||||||
four
|
|
||||||
five
|
|
||||||
six
|
|
||||||
seven
|
|
||||||
eight
|
|
||||||
nine
|
|
||||||
ten
|
|
101
test/functional/legacy/072_undo_file_spec.lua
Normal file
101
test/functional/legacy/072_undo_file_spec.lua
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
-- Tests for undo file.
|
||||||
|
-- Since this script is sourced we need to explicitly break changes up in
|
||||||
|
-- undo-able pieces. Do that by setting 'undolevels'.
|
||||||
|
|
||||||
|
local helpers = require('test.functional.helpers')
|
||||||
|
local feed, insert, source = helpers.feed, helpers.insert, helpers.source
|
||||||
|
local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
|
||||||
|
|
||||||
|
describe('72', function()
|
||||||
|
setup(clear)
|
||||||
|
|
||||||
|
it('is working', function()
|
||||||
|
insert([[
|
||||||
|
1111 -----
|
||||||
|
2222 -----
|
||||||
|
|
||||||
|
123456789]])
|
||||||
|
|
||||||
|
-- Test 'undofile': first a simple one-line change.
|
||||||
|
execute('set visualbell')
|
||||||
|
execute('set ul=100 undofile nomore')
|
||||||
|
execute('e! Xtestfile')
|
||||||
|
feed('ggdGithis is one line<esc>:set ul=100<cr>')
|
||||||
|
execute('s/one/ONE/')
|
||||||
|
execute('set ul=100')
|
||||||
|
execute('w')
|
||||||
|
execute('bwipe!')
|
||||||
|
execute('e Xtestfile')
|
||||||
|
feed('u:.w! test.out<cr>')
|
||||||
|
|
||||||
|
-- Test 'undofile', change in original file fails check.
|
||||||
|
execute('set noundofile')
|
||||||
|
execute('e! Xtestfile')
|
||||||
|
execute('s/line/Line/')
|
||||||
|
execute('w')
|
||||||
|
execute('set undofile')
|
||||||
|
execute('bwipe!')
|
||||||
|
execute('e Xtestfile')
|
||||||
|
---- TODO: this beeps.
|
||||||
|
feed('u:.w >>test.out<cr>')
|
||||||
|
|
||||||
|
-- Test 'undofile', add 10 lines, delete 6 lines, undo 3.
|
||||||
|
execute('set undofile')
|
||||||
|
feed('ggdGione<cr>')
|
||||||
|
feed('two<cr>')
|
||||||
|
feed('three<cr>')
|
||||||
|
feed('four<cr>')
|
||||||
|
feed('five<cr>')
|
||||||
|
feed('six<cr>')
|
||||||
|
feed('seven<cr>')
|
||||||
|
feed('eight<cr>')
|
||||||
|
feed('nine<cr>')
|
||||||
|
feed('ten<esc>:set ul=100<cr>')
|
||||||
|
feed('3Gdd:set ul=100<cr>')
|
||||||
|
feed('dd:set ul=100<cr>')
|
||||||
|
feed('dd:set ul=100<cr>')
|
||||||
|
feed('dd:set ul=100<cr>')
|
||||||
|
feed('dd:set ul=100<cr>')
|
||||||
|
feed('dd:set ul=100<cr>')
|
||||||
|
execute('w')
|
||||||
|
execute('bwipe!')
|
||||||
|
execute('e Xtestfile')
|
||||||
|
feed('uuu:w >>test.out<cr>')
|
||||||
|
|
||||||
|
-- Test that reading the undofiles when setting undofile works.
|
||||||
|
execute('set noundofile ul=0')
|
||||||
|
feed('i<cr>')
|
||||||
|
feed('<esc>u:e! Xtestfile<cr>')
|
||||||
|
execute('set undofile ul=100')
|
||||||
|
feed('uuuuuu:w >>test.out<cr>')
|
||||||
|
|
||||||
|
---- Open the output to see if it meets the expections
|
||||||
|
execute('e! test.out')
|
||||||
|
|
||||||
|
-- Assert buffer contents.
|
||||||
|
expect([[
|
||||||
|
this is one line
|
||||||
|
this is ONE Line
|
||||||
|
one
|
||||||
|
two
|
||||||
|
six
|
||||||
|
seven
|
||||||
|
eight
|
||||||
|
nine
|
||||||
|
ten
|
||||||
|
one
|
||||||
|
two
|
||||||
|
three
|
||||||
|
four
|
||||||
|
five
|
||||||
|
six
|
||||||
|
seven
|
||||||
|
eight
|
||||||
|
nine
|
||||||
|
ten]])
|
||||||
|
end)
|
||||||
|
|
||||||
|
teardown(function()
|
||||||
|
os.remove('.Xtestfile.un~')
|
||||||
|
end)
|
||||||
|
end)
|
Reference in New Issue
Block a user