aboutsummaryrefslogtreecommitdiff
path: root/test/functional/lua/buffer_updates_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/lua/buffer_updates_spec.lua')
-rw-r--r--test/functional/lua/buffer_updates_spec.lua96
1 files changed, 96 insertions, 0 deletions
diff --git a/test/functional/lua/buffer_updates_spec.lua b/test/functional/lua/buffer_updates_spec.lua
index 073927bf22..c83a50b78b 100644
--- a/test/functional/lua/buffer_updates_spec.lua
+++ b/test/functional/lua/buffer_updates_spec.lua
@@ -1050,6 +1050,102 @@ describe('lua: nvim_buf_attach on_bytes', function()
}
end)
+ it("sends updates on U", function()
+ feed("ggiAAA<cr>BBB")
+ feed("<esc>gg$a CCC")
+
+ local check_events = setup_eventcheck(verify, nil)
+
+ feed("ggU")
+
+ check_events {
+ { "test1", "bytes", 1, 6, 0, 7, 7, 0, 0, 0, 0, 3, 3 };
+ }
+ end)
+
+ it("delete in completely empty buffer", function()
+ local check_events = setup_eventcheck(verify, nil)
+
+ command "delete"
+ check_events { }
+ end)
+
+ it("delete the only line of a buffer", function()
+ local check_events = setup_eventcheck(verify, {"AAA"})
+
+ command "delete"
+ check_events {
+ { "test1", "bytes", 1, 3, 0, 0, 0, 1, 0, 4, 1, 0, 1 };
+ }
+ end)
+
+ it("delete the last line of a buffer with two lines", function()
+ local check_events = setup_eventcheck(verify, {"AAA", "BBB"})
+
+ command "2delete"
+ check_events {
+ { "test1", "bytes", 1, 3, 1, 0, 4, 1, 0, 4, 0, 0, 0 };
+ }
+ end)
+
+ it(":sort lines", function()
+ local check_events = setup_eventcheck(verify, {"CCC", "BBB", "AAA"})
+
+ command "%sort"
+ check_events {
+ { "test1", "bytes", 1, 3, 0, 0, 0, 3, 0, 12, 3, 0, 12 };
+ }
+ end)
+
+ it("handles already sorted lines", function()
+ local check_events = setup_eventcheck(verify, {"AAA", "BBB", "CCC"})
+
+ command "%sort"
+ check_events { }
+ end)
+
+ local function test_lockmarks(mode)
+ local description = (mode ~= "") and mode or "(baseline)"
+ it("test_lockmarks " .. description .. " %delete _", function()
+ local check_events = setup_eventcheck(verify, {"AAA", "BBB", "CCC"})
+
+ command(mode .. " %delete _")
+ check_events {
+ { "test1", "bytes", 1, 3, 0, 0, 0, 3, 0, 12, 1, 0, 1 };
+ }
+ end)
+
+ it("test_lockmarks " .. description .. " append()", function()
+ local check_events = setup_eventcheck(verify)
+
+ command(mode .. " call append(0, 'CCC')")
+ check_events {
+ { "test1", "bytes", 1, 2, 0, 0, 0, 0, 0, 0, 1, 0, 4 };
+ }
+
+ command(mode .. " call append(1, 'BBBB')")
+ check_events {
+ { "test1", "bytes", 1, 3, 1, 0, 4, 0, 0, 0, 1, 0, 5 };
+ }
+
+ command(mode .. " call append(2, '')")
+ check_events {
+ { "test1", "bytes", 1, 4, 2, 0, 9, 0, 0, 0, 1, 0, 1 };
+ }
+
+ command(mode .. " $delete _")
+ check_events {
+ { "test1", "bytes", 1, 5, 3, 0, 10, 1, 0, 1, 0, 0, 0 };
+ }
+
+ eq("CCC|BBBB|", table.concat(meths.buf_get_lines(0, 0, -1, true), "|"))
+ end)
+ end
+
+ -- check that behavior is identical with and without "lockmarks"
+ test_lockmarks ""
+ test_lockmarks "lockmarks"
+
teardown(function()
os.remove "Xtest-reload"
os.remove "Xtest-undofile"