mirror of
https://github.com/neovim/neovim.git
synced 2025-09-08 04:18:18 +00:00
functests: Test for “string cannot contain newline” set_lines error
Should make me able to determine whether they are lua bindings that contain a bug or set_lines.
This commit is contained in:
@@ -10,6 +10,7 @@ local insert = helpers.insert
|
|||||||
local NIL = helpers.NIL
|
local NIL = helpers.NIL
|
||||||
local meth_pcall = helpers.meth_pcall
|
local meth_pcall = helpers.meth_pcall
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
|
local bufmeths = helpers.bufmeths
|
||||||
|
|
||||||
describe('api/buf', function()
|
describe('api/buf', function()
|
||||||
before_each(clear)
|
before_each(clear)
|
||||||
@@ -121,6 +122,15 @@ describe('api/buf', function()
|
|||||||
local get_lines, set_lines = curbufmeths.get_lines, curbufmeths.set_lines
|
local get_lines, set_lines = curbufmeths.get_lines, curbufmeths.set_lines
|
||||||
local line_count = curbufmeths.line_count
|
local line_count = curbufmeths.line_count
|
||||||
|
|
||||||
|
it('fails correctly when input is not valid', function()
|
||||||
|
eq(1, curbufmeths.get_number())
|
||||||
|
local err, emsg = pcall(bufmeths.set_lines, 1, 1, 2, false, {'b\na'})
|
||||||
|
eq(false, err)
|
||||||
|
local exp_emsg = 'string cannot contain newlines'
|
||||||
|
-- Expected {filename}:{lnum}: {exp_emsg}
|
||||||
|
eq(': ' .. exp_emsg, emsg:sub(-#exp_emsg - 2))
|
||||||
|
end)
|
||||||
|
|
||||||
it('has correct line_count when inserting and deleting', function()
|
it('has correct line_count when inserting and deleting', function()
|
||||||
eq(1, line_count())
|
eq(1, line_count())
|
||||||
set_lines(-1, -1, true, {'line'})
|
set_lines(-1, -1, true, {'line'})
|
||||||
|
Reference in New Issue
Block a user