summaryrefslogtreecommitdiff
path: root/tests/run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run.lua')
-rw-r--r--tests/run.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index 38edcda..99674a5 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -6998,6 +6998,22 @@ test("Enabled eager events remove overlays and cancel timers", function()
end
end)
+test("MemoryHost limits scoped events to their buffer", function()
+ local host = MemoryHost.new({ buffer = "buffer-1" })
+ local deliveries = 0
+ host:register_events("TextChanged", function()
+ deliveries = deliveries + 1
+ end, { buffer = "buffer-1" })
+
+ host:deliver_event("TextChanged", {})
+ same(1, deliveries)
+ host:set_buffer("buffer-2")
+ host:deliver_event("TextChanged", {})
+ same(1, deliveries)
+ host:deliver_event("TextChanged", { buffer = "buffer-1" })
+ same(2, deliveries)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then