refactor(test): drop deprecated exc_exec #39242

This commit is contained in:
Justin M. Keyes
2026-04-20 14:16:41 -04:00
committed by GitHub
parent faa7c15b5a
commit 4ceca862fc
77 changed files with 1009 additions and 799 deletions

View File

@@ -2,9 +2,9 @@ local t = require('test.testutil')
local n = require('test.functional.testnvim')()
local eq = t.eq
local pcall_err = t.pcall_err
local clear = n.clear
local api = n.api
local exc_exec = n.exc_exec
local fn = n.fn
local rmdir = n.rmdir
local write_file = t.write_file
@@ -38,7 +38,7 @@ describe('spellfile', function()
-- │ │ ┌ Condition regex (missing!)
.. '\000\001\001')
api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E758: Truncated spell file', exc_exec('set spell'))
t.matches('Vim%(set%):E758: Truncated spell file', pcall_err(n.command, 'set spell'))
end)
it('errors out when prefcond regexp contains NUL byte', function()
api.nvim_set_option_value('runtimepath', testdir, {})
@@ -58,7 +58,7 @@ describe('spellfile', function()
-- │ │ ┌ PREFIXTREE tree length
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
t.matches('Vim%(set%):E759: Format error in spell file', pcall_err(n.command, 'set spell'))
end)
it('errors out when region contains NUL byte', function()
api.nvim_set_option_value('runtimepath', testdir, {})
@@ -75,7 +75,7 @@ describe('spellfile', function()
-- │ │ ┌ PREFIXTREE tree length
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
t.matches('Vim%(set%):E759: Format error in spell file', pcall_err(n.command, 'set spell'))
end)
it('errors out when SAL section contains NUL byte', function()
api.nvim_set_option_value('runtimepath', testdir, {})
@@ -99,13 +99,16 @@ describe('spellfile', function()
-- │ │ ┌ PREFIXTREE tree length
.. '\000\000\000\000\000\000\000\000\000\000\000\000')
api.nvim_set_option_value('spelllang', 'en', {})
eq('Vim(set):E759: Format error in spell file', exc_exec('set spell'))
t.matches('Vim%(set%):E759: Format error in spell file', pcall_err(n.command, 'set spell'))
end)
it('errors out when spell header contains NUL bytes', function()
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'))
t.matches(
'Vim%(set%):E757: This does not look like a spell file',
pcall_err(n.command, 'set spell')
)
end)
it('can be set to a relative path', function()
@@ -133,13 +136,13 @@ describe('spellfile', 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'))
eq("Vim(normal):E764: Option 'spellfile' is not set", pcall_err(n.command, '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'))
eq("Vim(normal):E764: Option 'spellfile' is not set", pcall_err(n.command, 'normal! zg'))
end)
it('accepts overwrites on midword and syllable section, errors on memory leak', function()