mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
test: make first attempt at some kind of test
This commit is contained in:
parent
f4c2de4c45
commit
a9df3fa5d2
@ -10,6 +10,7 @@ local request = helpers.request
|
||||
local retry = helpers.retry
|
||||
local rmdir = helpers.rmdir
|
||||
local sleep = helpers.sleep
|
||||
local read_file = helpers.read_file
|
||||
|
||||
describe('fileio', function()
|
||||
before_each(function()
|
||||
@ -18,6 +19,7 @@ describe('fileio', function()
|
||||
command(':qall!')
|
||||
os.remove('Xtest_startup_shada')
|
||||
os.remove('Xtest_startup_file1')
|
||||
os.remove('Xtest_startup_file1~')
|
||||
os.remove('Xtest_startup_file2')
|
||||
rmdir('Xtest_startup_swapdir')
|
||||
end)
|
||||
@ -64,5 +66,25 @@ describe('fileio', function()
|
||||
command('write')
|
||||
eq(4, request('nvim__stats').fsync)
|
||||
end)
|
||||
|
||||
it('creates a backup', function()
|
||||
clear({ args={ '-i', 'Xtest_startup_shada',
|
||||
'--cmd', 'set directory=Xtest_startup_swapdir' } })
|
||||
|
||||
command('write Xtest_startup_file1')
|
||||
feed('ifoo<esc>')
|
||||
command('set backup')
|
||||
command('set backupcopy=yes')
|
||||
command('write')
|
||||
feed('Abar<esc>')
|
||||
command('write')
|
||||
|
||||
local foo_contents = read_file('Xtest_startup_file1')
|
||||
local bar_contents = read_file('Xtest_startup_file1~')
|
||||
|
||||
eq('foobar\n', foo_contents);
|
||||
eq('foo\n', bar_contents);
|
||||
|
||||
end)
|
||||
end)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user