diff options
author | ZyX <kp-pav@yandex.ru> | 2017-04-11 02:24:37 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-04-11 02:24:37 +0300 |
commit | add76592d9a690d12e266da1f788e588bb42b919 (patch) | |
tree | 1ef89f9f9466847e2ffe984b58ed280deca5d404 /test/functional/api/buffer_spec.lua | |
parent | 0c5e359cb502cc858892930bcc8dbfadcdf09bd3 (diff) | |
download | rneovim-add76592d9a690d12e266da1f788e588bb42b919.tar.gz rneovim-add76592d9a690d12e266da1f788e588bb42b919.tar.bz2 rneovim-add76592d9a690d12e266da1f788e588bb42b919.zip |
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.
Diffstat (limited to 'test/functional/api/buffer_spec.lua')
-rw-r--r-- | test/functional/api/buffer_spec.lua | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/functional/api/buffer_spec.lua b/test/functional/api/buffer_spec.lua index c3002618b0..2e3b570571 100644 --- a/test/functional/api/buffer_spec.lua +++ b/test/functional/api/buffer_spec.lua @@ -10,6 +10,7 @@ local insert = helpers.insert local NIL = helpers.NIL local meth_pcall = helpers.meth_pcall local command = helpers.command +local bufmeths = helpers.bufmeths describe('api/buf', function() before_each(clear) @@ -121,6 +122,15 @@ describe('api/buf', function() local get_lines, set_lines = curbufmeths.get_lines, curbufmeths.set_lines 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() eq(1, line_count()) set_lines(-1, -1, true, {'line'}) |