aboutsummaryrefslogtreecommitdiff
path: root/test/functional/core
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/core')
-rw-r--r--test/functional/core/spellfile_spec.lua27
1 files changed, 26 insertions, 1 deletions
diff --git a/test/functional/core/spellfile_spec.lua b/test/functional/core/spellfile_spec.lua
index e2ccb038e7..96841f030e 100644
--- a/test/functional/core/spellfile_spec.lua
+++ b/test/functional/core/spellfile_spec.lua
@@ -14,7 +14,7 @@ local testdir = 'Xtest-functional-spell-spellfile.d'
describe('spellfile', function()
before_each(function()
- clear()
+ clear({ env = { XDG_DATA_HOME = testdir .. '/xdg_data' } })
rmdir(testdir)
mkdir(testdir)
mkdir(testdir .. '/spell')
@@ -117,4 +117,29 @@ describe('spellfile', function()
local fname = fn.fnamemodify(testdir .. '/spell/spell.add', ':p')
api.nvim_set_option_value('spellfile', fname, {})
end)
+
+ describe('default location', function()
+ it("is stdpath('data')/spell/en.utf-8.add", function()
+ n.command('set spell')
+ n.insert('abc')
+ n.feed('zg')
+ eq(
+ t.fix_slashes(fn.stdpath('data') .. '/spell/en.utf-8.add'),
+ t.fix_slashes(api.nvim_get_option_value('spellfile', {}))
+ )
+ end)
+
+ it("is not set if stdpath('data') is not writable", function()
+ n.command('set spell')
+ fn.writefile({ '' }, testdir .. '/xdg_data')
+ n.insert('abc')
+ eq("Vim(normal):E764: Option 'spellfile' is not set", exc_exec('normal! zg'))
+ end)
+
+ it("is not set if 'spelllang' is not set", function()
+ n.command('set spell spelllang=')
+ n.insert('abc')
+ eq("Vim(normal):E764: Option 'spellfile' is not set", exc_exec('normal! zg'))
+ end)
+ end)
end)