aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-04-16 21:33:40 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-04-27 16:19:40 +0200
commitf0a7e3fc9a6057d7e3e060d2de37e4fda9239046 (patch)
tree6058f0dae9885f118244ea722762d83f6995d0d4 /test
parent9d77a0768697aced470c72ba71d0e04cf45f0fd0 (diff)
downloadrneovim-f0a7e3fc9a6057d7e3e060d2de37e4fda9239046.tar.gz
rneovim-f0a7e3fc9a6057d7e3e060d2de37e4fda9239046.tar.bz2
rneovim-f0a7e3fc9a6057d7e3e060d2de37e4fda9239046.zip
test: 'shadafile' default
ref 773bdd41ec19
Diffstat (limited to 'test')
-rw-r--r--test/functional/helpers.lua5
-rw-r--r--test/functional/options/defaults_spec.lua46
2 files changed, 39 insertions, 12 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 7f9b5fe5fc..b518813f5d 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -351,12 +351,13 @@ end
-- Starts a new global Nvim session.
-- Parameters are interpreted as startup args, OR a map with these keys:
--- args: Merged with the default `nvim_argv` set.
+-- args: Appended to the default `nvim_argv` set.
-- env : Defines the environment of the new session.
+-- headless: Append --headless arg.
--
-- Example:
-- clear('-e')
--- clear({args={'-e'}, env={TERM=term}})
+-- clear{args={'-e'}, env={TERM=term}}
local function clear(...)
local args = {unpack(nvim_argv)}
local new_args
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index f6f3f02f45..209208ade2 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -15,6 +15,9 @@ local neq = helpers.neq
local mkdir = helpers.mkdir
local rmdir = helpers.rmdir
local alter_slashes = helpers.alter_slashes
+local spawn = helpers.spawn
+local nvim_prog = helpers.nvim_prog
+local set_session = helpers.set_session
describe('startup defaults', function()
describe(':filetype', function()
@@ -160,20 +163,43 @@ describe('startup defaults', function()
end)
end)
- describe("'packpath'", function()
- it('defaults to &runtimepath', function()
- eq(meths.get_option('runtimepath'), meths.get_option('packpath'))
- end)
+ it("'shadafile' ('viminfofile')", function()
+ -- Cannot use clear() because we do not want "-i NONE".
+ local function clear_use_default_shada()
+ set_session(spawn({nvim_prog, '-u', 'NONE', '--embed', '--headless'},
+ false,
+ {XDG_DATA_HOME='Xtest-userdata',
+ XDG_CONFIG_HOME='Xtest-userconfig'}))
+ end
+ clear_use_default_shada()
+ -- Default 'shadafile' is empty.
+ -- This means use the default location. :help shada-file-name
+ eq('', meths.get_option('shadafile'))
+ eq('', meths.get_option('viminfofile'))
+ -- Check that shada data (such as v:oldfiles) is saved/restored.
+ command('edit foo')
+ command('write')
+ local f = eval('fnamemodify(@%,":p")')
+ assert(string.len(f) > 3)
+ command('qall')
+ clear_use_default_shada()
+ eq({ f }, eval('v:oldfiles'))
+ end)
- it('does not follow modifications to runtimepath', function()
- meths.command('set runtimepath+=foo')
- neq(meths.get_option('runtimepath'), meths.get_option('packpath'))
- meths.command('set packpath+=foo')
- eq(meths.get_option('runtimepath'), meths.get_option('packpath'))
- end)
+ it("'packpath'", function()
+ clear()
+ -- Defaults to &runtimepath.
+ eq(meths.get_option('runtimepath'), meths.get_option('packpath'))
+
+ -- Does not follow modifications to runtimepath.
+ meths.command('set runtimepath+=foo')
+ neq(meths.get_option('runtimepath'), meths.get_option('packpath'))
+ meths.command('set packpath+=foo')
+ eq(meths.get_option('runtimepath'), meths.get_option('packpath'))
end)
it('v:progpath is set to the absolute path', function()
+ clear()
eq(eval("fnamemodify(v:progpath, ':p')"), eval('v:progpath'))
end)