aboutsummaryrefslogtreecommitdiff
path: root/test/functional/options/defaults_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-03-02 14:27:52 -0800
committerGitHub <noreply@github.com>2025-03-02 14:27:52 -0800
commitc4a0c1d3b02761626ffced32fe74b0df5b665a5f (patch)
treed83ec56eed5ee6b9f8c5683a84f3062b577a991e /test/functional/options/defaults_spec.lua
parent0a5a0efda64ccc789cda25b90fa907f277006cd3 (diff)
downloadrneovim-c4a0c1d3b02761626ffced32fe74b0df5b665a5f.tar.gz
rneovim-c4a0c1d3b02761626ffced32fe74b0df5b665a5f.tar.bz2
rneovim-c4a0c1d3b02761626ffced32fe74b0df5b665a5f.zip
docs: misc #31996
Diffstat (limited to 'test/functional/options/defaults_spec.lua')
-rw-r--r--test/functional/options/defaults_spec.lua31
1 files changed, 13 insertions, 18 deletions
diff --git a/test/functional/options/defaults_spec.lua b/test/functional/options/defaults_spec.lua
index a82279e775..83d45bcf62 100644
--- a/test/functional/options/defaults_spec.lua
+++ b/test/functional/options/defaults_spec.lua
@@ -888,8 +888,9 @@ describe('stdpath()', function()
os.remove(testlog)
end)
- -- Windows appends 'nvim-data' instead of just 'nvim' to prevent collisions
- -- due to XDG_CONFIG_HOME, XDG_DATA_HOME and XDG_STATE_HOME being the same.
+ --- Windows appends 'nvim-data' instead of just 'nvim' to prevent collisions
+ --- due to XDG_CONFIG_HOME, XDG_DATA_HOME and XDG_STATE_HOME being the same.
+ --- @param name string
local function maybe_data(name)
return is_os('win') and name .. '-data' or name
end
@@ -898,7 +899,7 @@ describe('stdpath()', function()
local statedir = maybe_data('nvim')
local env_sep = is_os('win') and ';' or ':'
- it('acceptance', function()
+ it('works', function()
clear() -- Do not explicitly set any env vars.
eq('nvim', fn.fnamemodify(fn.stdpath('cache'), ':t'))
@@ -911,6 +912,15 @@ describe('stdpath()', function()
assert_alive() -- Check for crash. #8393
end)
+ it('failure modes', function()
+ clear()
+ eq('Vim(call):E6100: "capybara" is not a valid stdpath', exc_exec('call stdpath("capybara")'))
+ eq('Vim(call):E6100: "" is not a valid stdpath', exc_exec('call stdpath("")'))
+ eq('Vim(call):E6100: "23" is not a valid stdpath', exc_exec('call stdpath(23)'))
+ eq('Vim(call):E731: Using a Dictionary as a String', exc_exec('call stdpath({"eris": 23})'))
+ eq('Vim(call):E730: Using a List as a String', exc_exec('call stdpath([23])'))
+ end)
+
it('$NVIM_APPNAME', function()
local appname = 'NVIM_APPNAME_TEST' .. ('_'):rep(106)
clear({ env = { NVIM_APPNAME = appname, NVIM_LOG_FILE = testlog } })
@@ -1263,19 +1273,4 @@ describe('stdpath()', function()
})
end)
end)
-
- describe('errors', function()
- before_each(clear)
-
- it('on unknown strings', function()
- eq('Vim(call):E6100: "capybara" is not a valid stdpath', exc_exec('call stdpath("capybara")'))
- eq('Vim(call):E6100: "" is not a valid stdpath', exc_exec('call stdpath("")'))
- eq('Vim(call):E6100: "23" is not a valid stdpath', exc_exec('call stdpath(23)'))
- end)
-
- it('on non-strings', function()
- eq('Vim(call):E731: Using a Dictionary as a String', exc_exec('call stdpath({"eris": 23})'))
- eq('Vim(call):E730: Using a List as a String', exc_exec('call stdpath([23])'))
- end)
- end)
end)