aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/ex_cmds/wviminfo_spec.lua33
-rw-r--r--test/functional/legacy/074_global_var_in_viminfo_spec.lua22
2 files changed, 30 insertions, 25 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)
diff --git a/test/functional/legacy/074_global_var_in_viminfo_spec.lua b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
index a89a4181cd..f017ed80a8 100644
--- a/test/functional/legacy/074_global_var_in_viminfo_spec.lua
+++ b/test/functional/legacy/074_global_var_in_viminfo_spec.lua
@@ -1,14 +1,15 @@
--- Tests for storing global variables in the .viminfo file
+-- Tests for storing global variables in the .shada file
local helpers, lfs = require('test.functional.helpers'), require('lfs')
local clear, execute, eq, neq, eval, wait, spawn =
helpers.clear, helpers.execute, helpers.eq, helpers.neq, helpers.eval,
helpers.wait, helpers.spawn
-describe('storing global variables in viminfo files', function()
+describe('storing global variables in ShaDa files', function()
+ local tempname = 'Xtest-functional-legacy-074'
setup(function()
clear()
- os.remove("Xviminfo")
+ os.remove(tempname)
end)
it('is working', function()
@@ -29,31 +30,32 @@ describe('storing global variables in viminfo files', function()
'set visualbell',
'set viminfo+=!',
"let MY_GLOBAL_DICT={'foo': 1, 'bar': 0, 'longvarible': 1000}",
- -- Store a really long list, so line wrapping will occur in viminfo
- -- file.
+ -- Store a really long list. Initially this was testing line wrapping in
+ -- viminfo, but shada files has no line wrapping, no matter how long the
+ -- list is.
'let MY_GLOBAL_LIST=range(1,100)'
)
eq(test_dict, eval('MY_GLOBAL_DICT'))
eq(test_list, eval('MY_GLOBAL_LIST'))
- execute('wv! Xviminfo')
+ execute('wv! ' .. tempname)
wait()
- -- Assert that the viminfo file exists.
- neq(nil, lfs.attributes('Xviminfo'))
+ -- Assert that the shada file exists.
+ neq(nil, lfs.attributes(tempname))
execute('unlet MY_GLOBAL_DICT',
'unlet MY_GLOBAL_LIST')
-- Assert that the variables where deleted.
eq(0, eval('exists("MY_GLOBAL_DICT")'))
eq(0, eval('exists("MY_GLOBAL_LIST")'))
- execute('rv! Xviminfo')
+ execute('rv! ' .. tempname)
eq(test_list, eval('MY_GLOBAL_LIST'))
eq(test_dict, eval('MY_GLOBAL_DICT'))
end)
teardown(function()
- os.remove('Xviminfo')
+ os.remove(tempname)
end)
end)