aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/defaults_spec.lua
diff options
context:
space:
mode:
authorRui Abreu Ferreira <raf-ep@gmx.com>2016-08-31 12:04:47 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-01-08 03:18:00 +0100
commit32156f06f7640411e89bc51832ca5e8bf0a87e05 (patch)
tree7fef5fe0b01fb5b566249186a499755ffba31675 /test/functional/options/defaults_spec.lua
parentca7a5c0ce7d499e9e792f9e2f5b16e821d07adb1 (diff)
downloadrneovim-32156f06f7640411e89bc51832ca5e8bf0a87e05.tar.gz
rneovim-32156f06f7640411e89bc51832ca5e8bf0a87e05.tar.bz2
rneovim-32156f06f7640411e89bc51832ca5e8bf0a87e05.zip
XDG: Windows: resolve $LOCALAPPDATA, $TEMP (#5278)
After #4964 environment variables in the XDG "fallback" table are no longer expanded. Fallback to correctly expanded $LOCALAPPDATA, $TEMP. If that fails (unlikely), fallback to hard-coded paths (e.g. ~/AppData/Local). Closes #5255
Diffstat (limited to 'test/functional/options/defaults_spec.lua')
-rw-r--r--test/functional/options/defaults_spec.lua35
1 files changed, 32 insertions, 3 deletions
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index 1ae855f26c..caeca5e4e2 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -9,8 +9,6 @@ local eval = helpers.eval
local eq = helpers.eq
local neq = helpers.neq
-if helpers.pending_win32(pending) then return end
-
local function init_session(...)
local args = { helpers.nvim_prog, '-i', 'NONE', '--embed',
'--cmd', 'set shortmess+=I background=light noswapfile noautoindent',
@@ -24,6 +22,8 @@ end
describe('startup defaults', function()
describe(':filetype', function()
+ if helpers.pending_win32(pending) then return end
+
local function expect_filetype(expected)
local screen = Screen.new(48, 4)
screen:attach()
@@ -99,8 +99,37 @@ describe('startup defaults', function()
end)
describe('XDG-based defaults', function()
- -- Need to be in separate describe() block to not run clear() twice.
+ -- Need separate describe() blocks to not run clear() twice.
-- Do not put before_each() here for the same reasons.
+
+ 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
+
describe('with too long XDG variables', function()
before_each(function()
clear({env={