Merge pull request #3470 from ZyX-I/pr-3198

XDG base directory specification support
This commit is contained in:
Justin M. Keyes
2015-10-25 22:38:23 -04:00
73 changed files with 1165 additions and 693 deletions

View File

@@ -118,7 +118,7 @@ describe('server -> client', function()
describe('when the client is a recursive vim instance', function()
before_each(function()
nvim('command', "let vim = rpcstart('"..nvim_prog.."', ['-u', 'NONE', '--embed'])")
nvim('command', "let vim = rpcstart('"..nvim_prog.."', ['-u', 'NONE', '-i', 'NONE', '--cmd', 'set noswapfile', '--embed'])")
neq(0, eval('vim'))
end)

View File

@@ -29,9 +29,11 @@ describe(':preserve', function()
it("saves to custom 'directory' and (R)ecovers (issue #1836)", function()
local testfile = 'testfile_recover_spec'
-- Note: `set swapfile` *must* go after `set directory`: otherwise it may
-- attempt to create a swapfile in different directory.
local init = [[
set swapfile fileformat=unix undolevels=-1
set directory^=]]..swapdir..[[//
set swapfile fileformat=unix undolevels=-1
]]
source(init)
@@ -47,7 +49,7 @@ describe(':preserve', function()
--TODO(justinmk): this is an ugly hack to force `helpers` to support
--multiple sessions.
local nvim2 = helpers.spawn({helpers.nvim_prog, '-u', 'NONE', '--embed'},
local nvim2 = helpers.spawn({helpers.nvim_prog, '-u', 'NONE', '-i', 'NONE', '--embed'},
true)
helpers.set_session(nvim2)

View File

@@ -13,7 +13,7 @@ describe(':wshada', function()
end
-- Override the default session because we need 'swapfile' for these tests.
local session = spawn({nvim_prog, '-u', 'NONE', '--embed',
local session = spawn({nvim_prog, '-u', 'NONE', '-i', '/dev/null', '--embed',
'--cmd', 'set swapfile'})
set_session(session)

View File

@@ -7,7 +7,7 @@ local Session = require('nvim.session')
local nvim_prog = os.getenv('NVIM_PROG') or 'build/bin/nvim'
local nvim_argv = {nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N',
'--cmd', 'set shortmess+=I background=light noswapfile noautoindent laststatus=1 encoding=utf-8',
'--cmd', 'set shortmess+=I background=light noswapfile noautoindent laststatus=1 encoding=utf-8 undodir=. directory=. viewdir=. backupdir=.',
'--embed'}
-- Formulate a path to the directory containing nvim. We use this to

View File

@@ -18,7 +18,7 @@ describe('72', function()
-- Test 'undofile': first a simple one-line change.
execute('set visualbell')
execute('set ul=100 undofile nomore')
execute('set ul=100 undofile undodir=. nomore')
execute('e! Xtestfile')
feed('ggdGithis is one line<esc>:set ul=100<cr>')
execute('s/one/ONE/')

View File

@@ -17,7 +17,7 @@ describe('78', function()
it('is working', function()
source([=[
set swapfile fileformat=unix undolevels=-1
set directory=. swapfile fileformat=unix undolevels=-1
e! Xtest
let text = "\tabcdefghijklmnoparstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnoparstuvwxyz0123456789"
let i = 1

View File

@@ -11,7 +11,7 @@ describe('tui', function()
before_each(function()
helpers.clear()
screen = thelpers.screen_setup(0, '["'..helpers.nvim_prog..'", "-u", "NONE", "--cmd", "set noswapfile"]')
screen = thelpers.screen_setup(0, '["'..helpers.nvim_prog..'", "-u", "NONE", "-i", "NONE", "--cmd", "set noswapfile"]')
screen.timeout = 30000 -- pasting can be really slow in the TUI
screen:expect([[
{1: } |

View File

@@ -125,7 +125,7 @@ end
do
local spawn, nvim_prog = helpers.spawn, helpers.nvim_prog
local session = spawn({nvim_prog, '-u', 'NONE', '-N', '--embed'})
local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N', '--embed'})
local status, rv = session:request('vim_get_color_map')
if not status then
print('failed to get color map')

View File

@@ -564,6 +564,28 @@ describe('fs function', function()
eq(false, os_isdir('unit-test-directory/new-dir-recurse'))
end)
it('succeeds to create a directory ending with ///', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/new-dir-recurse///', mode)
eq(0, ret)
eq(nil, failed_str)
eq(true, os_isdir('unit-test-directory/new-dir-recurse'))
lfs.rmdir('unit-test-directory/new-dir-recurse')
eq(false, os_isdir('unit-test-directory/new-dir-recurse'))
end)
it('succeeds to create a directory ending with /', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(
'unit-test-directory/new-dir-recurse/', mode)
eq(0, ret)
eq(nil, failed_str)
eq(true, os_isdir('unit-test-directory/new-dir-recurse'))
lfs.rmdir('unit-test-directory/new-dir-recurse')
eq(false, os_isdir('unit-test-directory/new-dir-recurse'))
end)
it('succeeds to create a directory tree', function()
local mode = ffi.C.kS_IRUSR + ffi.C.kS_IWUSR + ffi.C.kS_IXUSR
local ret, failed_str = os_mkdir_recurse(