mirror of
https://github.com/neovim/neovim.git
synced 2025-11-17 15:51:32 +00:00
test: use matches(...) instead of ok(string.find(...)) (#28111)
This commit is contained in:
@@ -1593,9 +1593,7 @@ describe('API', function()
|
||||
api.nvim_set_option_value('equalalways', false, {})
|
||||
local status, rv = pcall(command_output, 'verbose set equalalways?')
|
||||
eq(true, status)
|
||||
ok(
|
||||
nil ~= string.find(rv, 'noequalalways\n' .. '\tLast set from API client %(channel id %d+%)')
|
||||
)
|
||||
matches('noequalalways\n' .. '\tLast set from API client %(channel id %d+%)', rv)
|
||||
|
||||
api.nvim_exec_lua('vim.api.nvim_set_option_value("equalalways", true, {})', {})
|
||||
status, rv = pcall(command_output, 'verbose set equalalways?')
|
||||
@@ -2723,7 +2721,7 @@ describe('API', function()
|
||||
it('can throw exceptions', function()
|
||||
local status, err = pcall(api.nvim_get_option_value, 'invalid-option', {})
|
||||
eq(false, status)
|
||||
ok(err:match("Unknown option 'invalid%-option'") ~= nil)
|
||||
matches("Unknown option 'invalid%-option'", err)
|
||||
end)
|
||||
|
||||
it('does not truncate error message <1 MB #5984', function()
|
||||
@@ -2736,10 +2734,7 @@ describe('API', function()
|
||||
it('does not leak memory on incorrect argument types', function()
|
||||
local status, err = pcall(api.nvim_set_current_dir, { 'not', 'a', 'dir' })
|
||||
eq(false, status)
|
||||
ok(
|
||||
err:match(': Wrong type for argument 1 when calling nvim_set_current_dir, expecting String')
|
||||
~= nil
|
||||
)
|
||||
matches(': Wrong type for argument 1 when calling nvim_set_current_dir, expecting String', err)
|
||||
end)
|
||||
|
||||
describe('nvim_parse_expression', function()
|
||||
@@ -3670,7 +3665,7 @@ describe('API', function()
|
||||
api.nvim_buf_set_name(buf, 'mybuf')
|
||||
local mark = api.nvim_get_mark('F', {})
|
||||
-- Compare the path tail only
|
||||
assert(string.find(mark[4], 'mybuf$'))
|
||||
matches('mybuf$', mark[4])
|
||||
eq({ 2, 2, buf, mark[4] }, mark)
|
||||
end)
|
||||
it('validation', function()
|
||||
|
||||
Reference in New Issue
Block a user