aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-05-31 02:04:03 +0200
committerJustin M. Keyes <justinkz@gmail.com>2017-06-07 00:26:56 +0200
commitbb96b8219dc6a776bf0e765cfbc16a833e98b351 (patch)
tree5612d84b9e90dc10d6a246006374aad849026b2a /test/functional
parent05cdbbc18b40004a7065c0cbdee24598e10554e9 (diff)
downloadrneovim-bb96b8219dc6a776bf0e765cfbc16a833e98b351.tar.gz
rneovim-bb96b8219dc6a776bf0e765cfbc16a833e98b351.tar.bz2
rneovim-bb96b8219dc6a776bf0e765cfbc16a833e98b351.zip
log: set $NVIM_LOG_FILE; fallback to $XDG_DATA_HOME/nvim/log
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/options/defaults_spec.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index dc73679bb4..34921df6d4 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -121,6 +121,36 @@ describe('startup defaults', function()
it('v:progpath is set to the absolute path', function()
eq(eval("fnamemodify(v:progpath, ':p')"), eval('v:progpath'))
end)
+
+ describe('$NVIM_LOG_FILE', function()
+ after_each(function()
+ os.remove('Xtest-logpath')
+ end)
+ it('is used if expansion succeeds', function()
+ clear({env={
+ NVIM_LOG_FILE='Xtest-logpath',
+ }})
+ eq('Xtest-logpath', eval('$NVIM_LOG_FILE'))
+ end)
+ it('defaults to stdpath("data")/log', function()
+ clear({env={
+ XDG_DATA_HOME='Xtest-startup-logpath',
+ NVIM_LOG_FILE='', -- Empty value is considered invalid.
+ }})
+ -- TODO(jkeyes): use stdpath('data') instead.
+ local dir = helpers.iswin() and 'nvim-data' or 'nvim'
+ eq('Xtest-startup-logpath/'..dir..'/log', string.gsub(eval('$NVIM_LOG_FILE'), '\\', '/'))
+ end)
+ it('if invalid, falls back to default', function()
+ clear({env={
+ XDG_DATA_HOME='Xtest-startup-logpath',
+ NVIM_LOG_FILE='.', -- Directory is considered invalid.
+ }})
+ -- TODO(jkeyes): use stdpath('data') instead.
+ local dir = helpers.iswin() and 'nvim-data' or 'nvim'
+ eq('Xtest-startup-logpath/'..dir..'/log', string.gsub(eval('$NVIM_LOG_FILE'), '\\', '/'))
+ end)
+ end)
end)
describe('XDG-based defaults', function()