diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 14:57:57 -0700 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-03-09 14:57:57 -0700 |
commit | c324271b99eee4c621463f368914d57cd729bd9c (patch) | |
tree | 5d979d333a2d5f9c080991d5482fd5916f8579c6 /test/functional/core/spellfile_spec.lua | |
parent | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (diff) | |
parent | ade1b12f49c3b3914c74847d791eb90ea90b56b7 (diff) | |
download | rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.gz rneovim-c324271b99eee4c621463f368914d57cd729bd9c.tar.bz2 rneovim-c324271b99eee4c621463f368914d57cd729bd9c.zip |
Merge remote-tracking branch 'upstream/master' into userreg
Diffstat (limited to 'test/functional/core/spellfile_spec.lua')
-rw-r--r-- | test/functional/core/spellfile_spec.lua | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/test/functional/core/spellfile_spec.lua b/test/functional/core/spellfile_spec.lua index e3a59085cf..57953b8f80 100644 --- a/test/functional/core/spellfile_spec.lua +++ b/test/functional/core/spellfile_spec.lua @@ -2,8 +2,9 @@ local helpers = require('test.functional.helpers')(after_each) local eq = helpers.eq local clear = helpers.clear -local meths = helpers.meths +local api = helpers.api local exc_exec = helpers.exc_exec +local fn = helpers.fn local rmdir = helpers.rmdir local write_file = helpers.write_file local mkdir = helpers.mkdir @@ -24,7 +25,8 @@ describe('spellfile', function() -- │ ┌ Spell file version (#VIMSPELLVERSION) local spellheader = 'VIMspell\050' it('errors out when prefcond section is truncated', function() - meths.set_option_value('runtimepath', testdir, {}) + api.nvim_set_option_value('runtimepath', testdir, {}) + -- stylua: ignore write_file(testdir .. '/spell/en.ascii.spl', -- ┌ Section identifier (#SN_PREFCOND) -- │ ┌ Section flags (#SNF_REQUIRED or zero) @@ -34,12 +36,12 @@ describe('spellfile', function() -- │ ┌ Condition length (1 byte) -- │ │ ┌ Condition regex (missing!) .. '\000\001\001') - meths.set_option_value('spelllang', 'en', {}) - eq('Vim(set):E758: Truncated spell file', - exc_exec('set spell')) + api.nvim_set_option_value('spelllang', 'en', {}) + eq('Vim(set):E758: Truncated spell file', exc_exec('set spell')) end) it('errors out when prefcond regexp contains NUL byte', function() - meths.set_option_value('runtimepath', testdir, {}) + api.nvim_set_option_value('runtimepath', testdir, {}) + -- stylua: ignore write_file(testdir .. '/spell/en.ascii.spl', -- ┌ Section identifier (#SN_PREFCOND) -- │ ┌ Section flags (#SNF_REQUIRED or zero) @@ -54,12 +56,12 @@ describe('spellfile', function() -- │ ┌ KWORDTREE tree length (4 bytes) -- │ │ ┌ PREFIXTREE tree length .. '\000\000\000\000\000\000\000\000\000\000\000\000') - meths.set_option_value('spelllang', 'en', {}) - eq('Vim(set):E759: Format error in spell file', - exc_exec('set spell')) + api.nvim_set_option_value('spelllang', 'en', {}) + eq('Vim(set):E759: Format error in spell file', exc_exec('set spell')) end) it('errors out when region contains NUL byte', function() - meths.set_option_value('runtimepath', testdir, {}) + api.nvim_set_option_value('runtimepath', testdir, {}) + -- stylua: ignore write_file(testdir .. '/spell/en.ascii.spl', -- ┌ Section identifier (#SN_REGION) -- │ ┌ Section flags (#SNF_REQUIRED or zero) @@ -71,12 +73,12 @@ describe('spellfile', function() -- │ ┌ KWORDTREE tree length (4 bytes) -- │ │ ┌ PREFIXTREE tree length .. '\000\000\000\000\000\000\000\000\000\000\000\000') - meths.set_option_value('spelllang', 'en', {}) - eq('Vim(set):E759: Format error in spell file', - exc_exec('set spell')) + api.nvim_set_option_value('spelllang', 'en', {}) + eq('Vim(set):E759: Format error in spell file', exc_exec('set spell')) end) it('errors out when SAL section contains NUL byte', function() - meths.set_option_value('runtimepath', testdir, {}) + api.nvim_set_option_value('runtimepath', testdir, {}) + -- stylua: ignore write_file(testdir .. '/spell/en.ascii.spl', -- ┌ Section identifier (#SN_SAL) -- │ ┌ Section flags (#SNF_REQUIRED or zero) @@ -95,16 +97,23 @@ describe('spellfile', function() -- │ ┌ KWORDTREE tree length (4 bytes) -- │ │ ┌ PREFIXTREE tree length .. '\000\000\000\000\000\000\000\000\000\000\000\000') - meths.set_option_value('spelllang', 'en', {}) - eq('Vim(set):E759: Format error in spell file', - exc_exec('set spell')) + api.nvim_set_option_value('spelllang', 'en', {}) + eq('Vim(set):E759: Format error in spell file', exc_exec('set spell')) end) it('errors out when spell header contains NUL bytes', function() - meths.set_option_value('runtimepath', testdir, {}) - write_file(testdir .. '/spell/en.ascii.spl', - spellheader:sub(1, -3) .. '\000\000') - meths.set_option_value('spelllang', 'en', {}) - eq('Vim(set):E757: This does not look like a spell file', - exc_exec('set spell')) + api.nvim_set_option_value('runtimepath', testdir, {}) + write_file(testdir .. '/spell/en.ascii.spl', spellheader:sub(1, -3) .. '\000\000') + api.nvim_set_option_value('spelllang', 'en', {}) + eq('Vim(set):E757: This does not look like a spell file', exc_exec('set spell')) + end) + + it('can be set to a relative path', function() + local fname = testdir .. '/spell/spell.add' + api.nvim_set_option_value('spellfile', fname, {}) + end) + + it('can be set to an absolute path', function() + local fname = fn.fnamemodify(testdir .. '/spell/spell.add', ':p') + api.nvim_set_option_value('spellfile', fname, {}) end) end) |