2016-04-23 16:53:11 -07:00
|
|
|
local helpers = require('test.functional.helpers')(after_each)
|
2016-06-26 08:16:54 -07:00
|
|
|
|
2016-04-10 22:59:32 -07:00
|
|
|
local Screen = require('test.functional.ui.screen')
|
2016-06-26 08:16:54 -07:00
|
|
|
|
|
|
|
local meths = helpers.meths
|
2017-04-08 14:12:26 -07:00
|
|
|
local command = helpers.command
|
2016-06-26 08:16:54 -07:00
|
|
|
local clear = helpers.clear
|
|
|
|
local eval = helpers.eval
|
|
|
|
local eq = helpers.eq
|
2018-02-08 16:44:24 -07:00
|
|
|
local insert = helpers.insert
|
2016-08-08 15:19:26 -07:00
|
|
|
local neq = helpers.neq
|
2017-05-31 09:12:26 -07:00
|
|
|
local mkdir = helpers.mkdir
|
|
|
|
local rmdir = helpers.rmdir
|
2016-04-10 22:59:32 -07:00
|
|
|
|
|
|
|
describe('startup defaults', function()
|
|
|
|
describe(':filetype', function()
|
|
|
|
local function expect_filetype(expected)
|
2017-04-26 13:50:36 -07:00
|
|
|
local screen = Screen.new(50, 4)
|
2016-04-10 22:59:32 -07:00
|
|
|
screen:attach()
|
2017-04-08 14:12:26 -07:00
|
|
|
command('filetype')
|
2016-04-10 22:59:32 -07:00
|
|
|
screen:expect([[
|
2017-04-26 13:50:36 -07:00
|
|
|
^ |
|
|
|
|
~ |
|
|
|
|
~ |
|
2016-04-10 22:59:32 -07:00
|
|
|
]]..expected
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2018-01-03 11:57:22 -07:00
|
|
|
it('all ON after `-u NORC`', function()
|
|
|
|
clear('-u', 'NORC')
|
2016-04-10 22:59:32 -07:00
|
|
|
expect_filetype(
|
2017-04-26 13:50:36 -07:00
|
|
|
'filetype detection:ON plugin:ON indent:ON |')
|
2016-04-10 22:59:32 -07:00
|
|
|
end)
|
|
|
|
|
2018-01-03 11:57:22 -07:00
|
|
|
it('all ON after `:syntax …` #7765', function()
|
|
|
|
clear('-u', 'NORC', '--cmd', 'syntax on')
|
2016-04-10 22:59:32 -07:00
|
|
|
expect_filetype(
|
2018-01-03 11:57:22 -07:00
|
|
|
'filetype detection:ON plugin:ON indent:ON |')
|
|
|
|
clear('-u', 'NORC', '--cmd', 'syntax off')
|
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:ON plugin:ON indent:ON |')
|
2016-04-10 22:59:32 -07:00
|
|
|
end)
|
|
|
|
|
2018-01-03 11:57:22 -07:00
|
|
|
it('all OFF after `-u NONE`', function()
|
|
|
|
clear('-u', 'NONE')
|
2016-04-10 22:59:32 -07:00
|
|
|
expect_filetype(
|
2018-01-03 11:57:22 -07:00
|
|
|
'filetype detection:OFF plugin:OFF indent:OFF |')
|
2016-04-10 22:59:32 -07:00
|
|
|
end)
|
|
|
|
|
2018-01-03 11:57:22 -07:00
|
|
|
it('explicit OFF stays OFF', function()
|
|
|
|
clear('-u', 'NORC', '--cmd',
|
|
|
|
'syntax off | filetype off | filetype plugin indent off')
|
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:OFF plugin:OFF indent:OFF |')
|
|
|
|
clear('-u', 'NORC', '--cmd', 'syntax off | filetype plugin indent off')
|
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:ON plugin:OFF indent:OFF |')
|
|
|
|
clear('-u', 'NORC', '--cmd', 'filetype indent off')
|
2016-04-10 22:59:32 -07:00
|
|
|
expect_filetype(
|
2017-04-26 13:50:36 -07:00
|
|
|
'filetype detection:ON plugin:ON indent:OFF |')
|
2018-01-03 11:57:22 -07:00
|
|
|
clear('-u', 'NORC', '--cmd', 'syntax off | filetype off')
|
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:OFF plugin:(on) indent:(on) |')
|
|
|
|
-- Swap the order.
|
|
|
|
clear('-u', 'NORC', '--cmd', 'filetype off | syntax off')
|
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:OFF plugin:(on) indent:(on) |')
|
2016-04-10 22:59:32 -07:00
|
|
|
end)
|
|
|
|
|
2018-01-03 11:57:22 -07:00
|
|
|
it('all ON after early `:filetype … on`', function()
|
|
|
|
-- `:filetype … on` should not change the defaults. #7765
|
|
|
|
-- Only an explicit `:filetype … off` sets OFF.
|
|
|
|
|
|
|
|
clear('-u', 'NORC', '--cmd', 'filetype on')
|
2016-04-10 22:59:32 -07:00
|
|
|
expect_filetype(
|
2018-01-03 11:57:22 -07:00
|
|
|
'filetype detection:ON plugin:ON indent:ON |')
|
|
|
|
clear('-u', 'NORC', '--cmd', 'filetype plugin on')
|
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:ON plugin:ON indent:ON |')
|
|
|
|
clear('-u', 'NORC', '--cmd', 'filetype indent on')
|
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:ON plugin:ON indent:ON |')
|
2017-04-26 13:50:36 -07:00
|
|
|
end)
|
|
|
|
|
2018-01-03 11:57:22 -07:00
|
|
|
it('late `:filetype … off` stays OFF', function()
|
|
|
|
clear('-u', 'NORC', '-c', 'filetype off')
|
2017-04-26 13:50:36 -07:00
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:OFF plugin:(on) indent:(on) |')
|
2018-01-03 11:57:22 -07:00
|
|
|
clear('-u', 'NORC', '-c', 'filetype plugin off')
|
2017-04-26 13:50:36 -07:00
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:ON plugin:OFF indent:ON |')
|
2018-01-03 11:57:22 -07:00
|
|
|
clear('-u', 'NORC', '-c', 'filetype indent off')
|
2017-04-26 13:50:36 -07:00
|
|
|
expect_filetype(
|
|
|
|
'filetype detection:ON plugin:ON indent:OFF |')
|
2016-04-10 22:59:32 -07:00
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('syntax', function()
|
|
|
|
it('enabled by `-u NORC`', function()
|
2018-01-03 11:57:22 -07:00
|
|
|
clear('-u', 'NORC')
|
2016-04-10 22:59:32 -07:00
|
|
|
eq(1, eval('g:syntax_on'))
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('disabled by `-u NONE`', function()
|
2018-01-03 11:57:22 -07:00
|
|
|
clear('-u', 'NONE')
|
2016-04-10 22:59:32 -07:00
|
|
|
eq(0, eval('exists("g:syntax_on")'))
|
|
|
|
end)
|
|
|
|
|
2018-01-03 11:57:22 -07:00
|
|
|
it('`:syntax off` stays off', function()
|
|
|
|
-- early
|
|
|
|
clear('-u', 'NORC', '--cmd', 'syntax off')
|
2016-04-10 22:59:32 -07:00
|
|
|
eq(0, eval('exists("g:syntax_on")'))
|
2018-01-03 11:57:22 -07:00
|
|
|
-- late
|
|
|
|
clear('-u', 'NORC', '-c', 'syntax off')
|
2017-04-26 13:50:36 -07:00
|
|
|
eq(0, eval('exists("g:syntax_on")'))
|
|
|
|
end)
|
2016-04-10 22:59:32 -07:00
|
|
|
end)
|
2016-08-08 15:19:26 -07:00
|
|
|
|
2018-02-08 16:44:24 -07:00
|
|
|
describe("'fillchars'", function()
|
|
|
|
it('vert/fold flags', function()
|
|
|
|
clear()
|
|
|
|
local screen = Screen.new(50, 5)
|
|
|
|
screen:attach()
|
|
|
|
command('set laststatus=0')
|
|
|
|
insert([[
|
|
|
|
1
|
|
|
|
2
|
|
|
|
3
|
|
|
|
4]])
|
|
|
|
command('normal! ggjzfj')
|
|
|
|
command('vsp')
|
|
|
|
screen:expect([[
|
|
|
|
1 │1 |
|
|
|
|
^+-- 2 lines: 2··········│+-- 2 lines: 2·········|
|
|
|
|
4 │4 |
|
|
|
|
~ │~ |
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
|
|
|
|
-- ambiwidth=double defaults to single-byte fillchars.
|
|
|
|
command('set ambiwidth=double')
|
|
|
|
screen:expect([[
|
|
|
|
1 |1 |
|
|
|
|
^+-- 2 lines: 2----------|+-- 2 lines: 2---------|
|
|
|
|
4 |4 |
|
|
|
|
~ |~ |
|
|
|
|
|
|
|
|
|
]])
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe("'packpath'", function()
|
2016-08-08 15:19:26 -07:00
|
|
|
it('defaults to &runtimepath', function()
|
|
|
|
eq(meths.get_option('runtimepath'), meths.get_option('packpath'))
|
|
|
|
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)
|
|
|
|
end)
|
2017-02-02 05:16:15 -07:00
|
|
|
|
|
|
|
it('v:progpath is set to the absolute path', function()
|
|
|
|
eq(eval("fnamemodify(v:progpath, ':p')"), eval('v:progpath'))
|
|
|
|
end)
|
2017-05-30 17:04:03 -07:00
|
|
|
|
|
|
|
describe('$NVIM_LOG_FILE', function()
|
2017-05-31 09:12:26 -07:00
|
|
|
-- TODO(jkeyes): use stdpath('data') instead.
|
|
|
|
local datasubdir = helpers.iswin() and 'nvim-data' or 'nvim'
|
|
|
|
local xdgdir = 'Xtest-startup-xdg-logpath'
|
|
|
|
local xdgdatadir = xdgdir..'/'..datasubdir
|
2017-05-30 17:04:03 -07:00
|
|
|
after_each(function()
|
|
|
|
os.remove('Xtest-logpath')
|
2017-05-31 09:12:26 -07:00
|
|
|
rmdir(xdgdir)
|
2017-05-30 17:04:03 -07:00
|
|
|
end)
|
2017-05-31 09:12:26 -07:00
|
|
|
|
2017-05-30 17:04:03 -07:00
|
|
|
it('is used if expansion succeeds', function()
|
|
|
|
clear({env={
|
|
|
|
NVIM_LOG_FILE='Xtest-logpath',
|
|
|
|
}})
|
|
|
|
eq('Xtest-logpath', eval('$NVIM_LOG_FILE'))
|
|
|
|
end)
|
2017-05-31 09:12:26 -07:00
|
|
|
it('defaults to stdpath("data")/log if empty', function()
|
|
|
|
eq(true, mkdir(xdgdir) and mkdir(xdgdatadir))
|
2017-05-30 17:04:03 -07:00
|
|
|
clear({env={
|
2017-05-31 09:12:26 -07:00
|
|
|
XDG_DATA_HOME=xdgdir,
|
|
|
|
NVIM_LOG_FILE='', -- Empty is invalid.
|
2017-05-30 17:04:03 -07:00
|
|
|
}})
|
2017-05-31 09:12:26 -07:00
|
|
|
-- server_start() calls ELOG, which tickles log_path_init().
|
|
|
|
pcall(command, 'call serverstart(serverlist()[0])')
|
|
|
|
|
|
|
|
eq(xdgdir..'/'..datasubdir..'/log', string.gsub(eval('$NVIM_LOG_FILE'), '\\', '/'))
|
2017-05-30 17:04:03 -07:00
|
|
|
end)
|
2017-05-31 09:12:26 -07:00
|
|
|
it('defaults to stdpath("data")/log if invalid', function()
|
|
|
|
eq(true, mkdir(xdgdir) and mkdir(xdgdatadir))
|
2017-05-30 17:04:03 -07:00
|
|
|
clear({env={
|
2017-05-31 09:12:26 -07:00
|
|
|
XDG_DATA_HOME=xdgdir,
|
|
|
|
NVIM_LOG_FILE='.', -- Any directory is invalid.
|
2017-05-30 17:04:03 -07:00
|
|
|
}})
|
2017-05-31 09:12:26 -07:00
|
|
|
-- server_start() calls ELOG, which tickles log_path_init().
|
|
|
|
pcall(command, 'call serverstart(serverlist()[0])')
|
|
|
|
|
|
|
|
eq(xdgdir..'/'..datasubdir..'/log', string.gsub(eval('$NVIM_LOG_FILE'), '\\', '/'))
|
|
|
|
end)
|
|
|
|
it('defaults to .nvimlog if stdpath("data") is invalid', function()
|
|
|
|
clear({env={
|
|
|
|
XDG_DATA_HOME='Xtest-missing-xdg-dir',
|
|
|
|
NVIM_LOG_FILE='.', -- Any directory is invalid.
|
|
|
|
}})
|
|
|
|
-- server_start() calls ELOG, which tickles log_path_init().
|
|
|
|
pcall(command, 'call serverstart(serverlist()[0])')
|
|
|
|
|
|
|
|
eq('.nvimlog', eval('$NVIM_LOG_FILE'))
|
2017-05-30 17:04:03 -07:00
|
|
|
end)
|
|
|
|
end)
|
2016-04-10 22:59:32 -07:00
|
|
|
end)
|
2016-06-26 08:16:54 -07:00
|
|
|
|
|
|
|
describe('XDG-based defaults', function()
|
2016-08-31 04:04:47 -07:00
|
|
|
-- Need separate describe() blocks to not run clear() twice.
|
2016-06-26 08:16:54 -07:00
|
|
|
-- Do not put before_each() here for the same reasons.
|
2016-08-31 04:04:47 -07:00
|
|
|
|
|
|
|
describe('with empty/broken environment', function()
|
|
|
|
it('sets correct defaults', function()
|
|
|
|
clear({env={
|
|
|
|
XDG_CONFIG_HOME=nil,
|
|
|
|
XDG_DATA_HOME=nil,
|
|
|
|
XDG_CACHE_HOME=nil,
|
|
|
|
XDG_RUNTIME_DIR=nil,
|
|
|
|
XDG_CONFIG_DIRS=nil,
|
|
|
|
XDG_DATA_DIRS=nil,
|
|
|
|
LOCALAPPDATA=nil,
|
|
|
|
HOMEPATH=nil,
|
|
|
|
HOMEDRIVE=nil,
|
|
|
|
HOME=nil,
|
|
|
|
TEMP=nil,
|
|
|
|
VIMRUNTIME=nil,
|
|
|
|
USER=nil,
|
|
|
|
}})
|
|
|
|
|
|
|
|
eq('.', meths.get_option('backupdir'))
|
|
|
|
eq('.', meths.get_option('viewdir'))
|
|
|
|
eq('.', meths.get_option('directory'))
|
|
|
|
eq('.', meths.get_option('undodir'))
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
-- TODO(jkeyes): tests below fail on win32 because of path separator.
|
|
|
|
if helpers.pending_win32(pending) then return end
|
|
|
|
|
2016-06-26 08:16:54 -07:00
|
|
|
describe('with too long XDG variables', function()
|
|
|
|
before_each(function()
|
|
|
|
clear({env={
|
|
|
|
XDG_CONFIG_HOME=('/x'):rep(4096),
|
|
|
|
XDG_CONFIG_DIRS=(('/a'):rep(2048)
|
|
|
|
.. ':' .. ('/b'):rep(2048)
|
|
|
|
.. (':/c'):rep(512)),
|
|
|
|
XDG_DATA_HOME=('/X'):rep(4096),
|
|
|
|
XDG_DATA_DIRS=(('/A'):rep(2048)
|
|
|
|
.. ':' .. ('/B'):rep(2048)
|
|
|
|
.. (':/C'):rep(512)),
|
|
|
|
}})
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('are correctly set', function()
|
|
|
|
eq((('/x'):rep(4096) .. '/nvim'
|
|
|
|
.. ',' .. ('/a'):rep(2048) .. '/nvim'
|
|
|
|
.. ',' .. ('/b'):rep(2048) .. '/nvim'
|
|
|
|
.. (',' .. '/c/nvim'):rep(512)
|
|
|
|
.. ',' .. ('/X'):rep(4096) .. '/nvim/site'
|
|
|
|
.. ',' .. ('/A'):rep(2048) .. '/nvim/site'
|
|
|
|
.. ',' .. ('/B'):rep(2048) .. '/nvim/site'
|
|
|
|
.. (',' .. '/C/nvim/site'):rep(512)
|
|
|
|
.. ',' .. eval('$VIMRUNTIME')
|
|
|
|
.. (',' .. '/C/nvim/site/after'):rep(512)
|
|
|
|
.. ',' .. ('/B'):rep(2048) .. '/nvim/site/after'
|
|
|
|
.. ',' .. ('/A'):rep(2048) .. '/nvim/site/after'
|
|
|
|
.. ',' .. ('/X'):rep(4096) .. '/nvim/site/after'
|
|
|
|
.. (',' .. '/c/nvim/after'):rep(512)
|
|
|
|
.. ',' .. ('/b'):rep(2048) .. '/nvim/after'
|
|
|
|
.. ',' .. ('/a'):rep(2048) .. '/nvim/after'
|
|
|
|
.. ',' .. ('/x'):rep(4096) .. '/nvim/after'
|
|
|
|
), meths.get_option('runtimepath'))
|
|
|
|
meths.command('set runtimepath&')
|
|
|
|
meths.command('set backupdir&')
|
|
|
|
meths.command('set directory&')
|
|
|
|
meths.command('set undodir&')
|
|
|
|
meths.command('set viewdir&')
|
|
|
|
eq((('/x'):rep(4096) .. '/nvim'
|
|
|
|
.. ',' .. ('/a'):rep(2048) .. '/nvim'
|
|
|
|
.. ',' .. ('/b'):rep(2048) .. '/nvim'
|
|
|
|
.. (',' .. '/c/nvim'):rep(512)
|
|
|
|
.. ',' .. ('/X'):rep(4096) .. '/nvim/site'
|
|
|
|
.. ',' .. ('/A'):rep(2048) .. '/nvim/site'
|
|
|
|
.. ',' .. ('/B'):rep(2048) .. '/nvim/site'
|
|
|
|
.. (',' .. '/C/nvim/site'):rep(512)
|
|
|
|
.. ',' .. eval('$VIMRUNTIME')
|
|
|
|
.. (',' .. '/C/nvim/site/after'):rep(512)
|
|
|
|
.. ',' .. ('/B'):rep(2048) .. '/nvim/site/after'
|
|
|
|
.. ',' .. ('/A'):rep(2048) .. '/nvim/site/after'
|
|
|
|
.. ',' .. ('/X'):rep(4096) .. '/nvim/site/after'
|
|
|
|
.. (',' .. '/c/nvim/after'):rep(512)
|
|
|
|
.. ',' .. ('/b'):rep(2048) .. '/nvim/after'
|
|
|
|
.. ',' .. ('/a'):rep(2048) .. '/nvim/after'
|
|
|
|
.. ',' .. ('/x'):rep(4096) .. '/nvim/after'
|
|
|
|
), meths.get_option('runtimepath'))
|
|
|
|
eq('.,' .. ('/X'):rep(4096) .. '/nvim/backup',
|
|
|
|
meths.get_option('backupdir'))
|
|
|
|
eq(('/X'):rep(4096) .. '/nvim/swap//', meths.get_option('directory'))
|
|
|
|
eq(('/X'):rep(4096) .. '/nvim/undo', meths.get_option('undodir'))
|
|
|
|
eq(('/X'):rep(4096) .. '/nvim/view', meths.get_option('viewdir'))
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('with XDG variables that can be expanded', function()
|
|
|
|
before_each(function()
|
|
|
|
clear({env={
|
|
|
|
XDG_CONFIG_HOME='$XDG_DATA_HOME',
|
|
|
|
XDG_CONFIG_DIRS='$XDG_DATA_DIRS',
|
|
|
|
XDG_DATA_HOME='$XDG_CONFIG_HOME',
|
|
|
|
XDG_DATA_DIRS='$XDG_CONFIG_DIRS',
|
|
|
|
}})
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('are not expanded', function()
|
|
|
|
eq(('$XDG_DATA_HOME/nvim'
|
|
|
|
.. ',$XDG_DATA_DIRS/nvim'
|
|
|
|
.. ',$XDG_CONFIG_HOME/nvim/site'
|
|
|
|
.. ',$XDG_CONFIG_DIRS/nvim/site'
|
|
|
|
.. ',' .. eval('$VIMRUNTIME')
|
|
|
|
.. ',$XDG_CONFIG_DIRS/nvim/site/after'
|
|
|
|
.. ',$XDG_CONFIG_HOME/nvim/site/after'
|
|
|
|
.. ',$XDG_DATA_DIRS/nvim/after'
|
|
|
|
.. ',$XDG_DATA_HOME/nvim/after'
|
|
|
|
), meths.get_option('runtimepath'))
|
|
|
|
meths.command('set runtimepath&')
|
|
|
|
meths.command('set backupdir&')
|
|
|
|
meths.command('set directory&')
|
|
|
|
meths.command('set undodir&')
|
|
|
|
meths.command('set viewdir&')
|
|
|
|
eq(('$XDG_DATA_HOME/nvim'
|
|
|
|
.. ',$XDG_DATA_DIRS/nvim'
|
|
|
|
.. ',$XDG_CONFIG_HOME/nvim/site'
|
|
|
|
.. ',$XDG_CONFIG_DIRS/nvim/site'
|
|
|
|
.. ',' .. eval('$VIMRUNTIME')
|
|
|
|
.. ',$XDG_CONFIG_DIRS/nvim/site/after'
|
|
|
|
.. ',$XDG_CONFIG_HOME/nvim/site/after'
|
|
|
|
.. ',$XDG_DATA_DIRS/nvim/after'
|
|
|
|
.. ',$XDG_DATA_HOME/nvim/after'
|
|
|
|
), meths.get_option('runtimepath'))
|
|
|
|
eq('.,$XDG_CONFIG_HOME/nvim/backup', meths.get_option('backupdir'))
|
|
|
|
eq('$XDG_CONFIG_HOME/nvim/swap//', meths.get_option('directory'))
|
2016-06-26 08:22:11 -07:00
|
|
|
eq('$XDG_CONFIG_HOME/nvim/undo', meths.get_option('undodir'))
|
|
|
|
eq('$XDG_CONFIG_HOME/nvim/view', meths.get_option('viewdir'))
|
|
|
|
meths.command('set all&')
|
|
|
|
eq(('$XDG_DATA_HOME/nvim'
|
|
|
|
.. ',$XDG_DATA_DIRS/nvim'
|
|
|
|
.. ',$XDG_CONFIG_HOME/nvim/site'
|
|
|
|
.. ',$XDG_CONFIG_DIRS/nvim/site'
|
|
|
|
.. ',' .. eval('$VIMRUNTIME')
|
|
|
|
.. ',$XDG_CONFIG_DIRS/nvim/site/after'
|
|
|
|
.. ',$XDG_CONFIG_HOME/nvim/site/after'
|
|
|
|
.. ',$XDG_DATA_DIRS/nvim/after'
|
|
|
|
.. ',$XDG_DATA_HOME/nvim/after'
|
|
|
|
), meths.get_option('runtimepath'))
|
|
|
|
eq('.,$XDG_CONFIG_HOME/nvim/backup', meths.get_option('backupdir'))
|
|
|
|
eq('$XDG_CONFIG_HOME/nvim/swap//', meths.get_option('directory'))
|
2016-06-26 08:16:54 -07:00
|
|
|
eq('$XDG_CONFIG_HOME/nvim/undo', meths.get_option('undodir'))
|
|
|
|
eq('$XDG_CONFIG_HOME/nvim/view', meths.get_option('viewdir'))
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
describe('with commas', function()
|
|
|
|
before_each(function()
|
|
|
|
clear({env={
|
|
|
|
XDG_CONFIG_HOME=', , ,',
|
|
|
|
XDG_CONFIG_DIRS=',-,-,:-,-,-',
|
|
|
|
XDG_DATA_HOME=',=,=,',
|
|
|
|
XDG_DATA_DIRS=',≡,≡,:≡,≡,≡',
|
|
|
|
}})
|
|
|
|
end)
|
|
|
|
|
|
|
|
it('are escaped properly', function()
|
|
|
|
eq(('\\, \\, \\,/nvim'
|
|
|
|
.. ',\\,-\\,-\\,/nvim'
|
|
|
|
.. ',-\\,-\\,-/nvim'
|
|
|
|
.. ',\\,=\\,=\\,/nvim/site'
|
|
|
|
.. ',\\,≡\\,≡\\,/nvim/site'
|
|
|
|
.. ',≡\\,≡\\,≡/nvim/site'
|
|
|
|
.. ',' .. eval('$VIMRUNTIME')
|
|
|
|
.. ',≡\\,≡\\,≡/nvim/site/after'
|
|
|
|
.. ',\\,≡\\,≡\\,/nvim/site/after'
|
|
|
|
.. ',\\,=\\,=\\,/nvim/site/after'
|
|
|
|
.. ',-\\,-\\,-/nvim/after'
|
|
|
|
.. ',\\,-\\,-\\,/nvim/after'
|
|
|
|
.. ',\\, \\, \\,/nvim/after'
|
|
|
|
), meths.get_option('runtimepath'))
|
|
|
|
meths.command('set runtimepath&')
|
|
|
|
meths.command('set backupdir&')
|
|
|
|
meths.command('set directory&')
|
|
|
|
meths.command('set undodir&')
|
|
|
|
meths.command('set viewdir&')
|
|
|
|
eq(('\\, \\, \\,/nvim'
|
|
|
|
.. ',\\,-\\,-\\,/nvim'
|
|
|
|
.. ',-\\,-\\,-/nvim'
|
|
|
|
.. ',\\,=\\,=\\,/nvim/site'
|
|
|
|
.. ',\\,≡\\,≡\\,/nvim/site'
|
|
|
|
.. ',≡\\,≡\\,≡/nvim/site'
|
|
|
|
.. ',' .. eval('$VIMRUNTIME')
|
|
|
|
.. ',≡\\,≡\\,≡/nvim/site/after'
|
|
|
|
.. ',\\,≡\\,≡\\,/nvim/site/after'
|
|
|
|
.. ',\\,=\\,=\\,/nvim/site/after'
|
|
|
|
.. ',-\\,-\\,-/nvim/after'
|
|
|
|
.. ',\\,-\\,-\\,/nvim/after'
|
|
|
|
.. ',\\, \\, \\,/nvim/after'
|
|
|
|
), meths.get_option('runtimepath'))
|
|
|
|
eq('.,\\,=\\,=\\,/nvim/backup', meths.get_option('backupdir'))
|
|
|
|
eq('\\,=\\,=\\,/nvim/swap//', meths.get_option('directory'))
|
|
|
|
eq('\\,=\\,=\\,/nvim/undo', meths.get_option('undodir'))
|
|
|
|
eq('\\,=\\,=\\,/nvim/view', meths.get_option('viewdir'))
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
end)
|