diff options
author | chentau <tchen1998@gmail.com> | 2021-05-05 19:57:04 -0700 |
---|---|---|
committer | chentau <tchen1998@gmail.com> | 2021-05-09 16:22:20 -0700 |
commit | a847abc21b339a8402d39cc2736f3f73e4f2f124 (patch) | |
tree | 5b27776f0d99f43977f3d1a423967ebe3f314246 /test/functional/lua/buffer_updates_spec.lua | |
parent | d2be261e8d1bcf165346255ae701564a5f62bf7d (diff) | |
download | rneovim-a847abc21b339a8402d39cc2736f3f73e4f2f124.tar.gz rneovim-a847abc21b339a8402d39cc2736f3f73e4f2f124.tar.bz2 rneovim-a847abc21b339a8402d39cc2736f3f73e4f2f124.zip |
refactor nvim_buf_set_lines to use extmark_splice
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r-- | test/functional/lua/buffer_updates_spec.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua index d4c65eae5b..bd7f0b9cdd 100644 --- a/test/functional/lua/buffer_updates_spec.lua +++ b/test/functional/lua/buffer_updates_spec.lua @@ -958,6 +958,29 @@ describe('lua: nvim_buf_attach on_bytes', function() } end) + it("nvim_buf_set_lines", function() + local check_events = setup_eventcheck(verify, {"AAA", "BBB"}) + + -- delete + command("lua vim.api.nvim_buf_set_lines(0, 0, 1, true, {})") + + check_events { + { "test1", "bytes", 1, 3, 0, 0, 0, 1, 0, 4, 0, 0, 0 }; + } + + -- add + command("lua vim.api.nvim_buf_set_lines(0, 0, 0, true, {'asdf'})") + check_events { + { "test1", "bytes", 1, 4, 0, 0, 0, 0, 0, 0, 1, 0, 5 }; + } + + -- replace + command("lua vim.api.nvim_buf_set_lines(0, 0, 1, true, {'asdf', 'fdsa'})") + check_events { + { "test1", "bytes", 1, 5, 0, 0, 0, 1, 0, 5, 2, 0, 10 }; + } + end) + teardown(function() os.remove "Xtest-reload" os.remove "Xtest-undofile" |