aboutsummaryrefslogtreecommitdiff
path: root/test/functional/ex_cmds/wviminfo_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/ex_cmds/wviminfo_spec.lua')
-rw-r--r--test/functional/ex_cmds/wviminfo_spec.lua33
1 files changed, 18 insertions, 15 deletions
diff --git a/test/functional/ex_cmds/wviminfo_spec.lua b/test/functional/ex_cmds/wviminfo_spec.lua
index f4911cd3e8..053555c267 100644
--- a/test/functional/ex_cmds/wviminfo_spec.lua
+++ b/test/functional/ex_cmds/wviminfo_spec.lua
@@ -4,7 +4,7 @@ local clear, execute, eq, neq, spawn, nvim_prog, set_session, wait, write_file
helpers.nvim_prog, helpers.set_session, helpers.wait, helpers.write_file
describe(':wviminfo', function()
- local viminfo_file = 'wviminfo_test'
+ local shada_file = 'wviminfo_test'
local session
before_each(function()
@@ -17,38 +17,41 @@ describe(':wviminfo', function()
'--cmd', 'set swapfile'})
set_session(session)
- os.remove(viminfo_file)
+ os.remove(shada_file)
end)
- it('creates a viminfo file', function()
+ it('creates a shada file', function()
-- file should _not_ exist
- eq(nil, lfs.attributes(viminfo_file))
- execute('wv! '..viminfo_file)
+ eq(nil, lfs.attributes(shada_file))
+ execute('wv! '..shada_file)
wait()
-- file _should_ exist
- neq(nil, lfs.attributes(viminfo_file))
+ neq(nil, lfs.attributes(shada_file))
end)
it('overwrites existing files', function()
local text = 'wviminfo test'
-- Create a dummy file
- write_file(viminfo_file, text)
+ write_file(shada_file, text)
-- sanity check
- eq(text, io.open(viminfo_file):read())
- neq(nil, lfs.attributes(viminfo_file))
+ eq(text, io.open(shada_file):read())
+ neq(nil, lfs.attributes(shada_file))
- execute('wv! '..viminfo_file)
+ execute('wv! '..shada_file)
wait()
- -- File should have been overwritten with a viminfo file.
- local line1 = io.lines(viminfo_file)()
- assert(nil ~= string.find(line1, 'This viminfo file was generated by Nvim'),
- viminfo_file..' should be a viminfo-formatted file')
+ -- File should have been overwritten with a shada file.
+ local fp = io.open(shada_file, 'r')
+ local char1 = fp:read(1)
+ fp:close()
+ -- ShaDa file starts with a “header” entry
+ assert(char1:byte() == 0x01,
+ shada_file..' should be a shada file')
end)
teardown(function()
- os.remove(viminfo_file)
+ os.remove(shada_file)
end)
end)