aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/util_dbuffer_spec.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/util_dbuffer_spec.lua b/spec/util_dbuffer_spec.lua
index c4fa22b2..b7f80dc9 100644
--- a/spec/util_dbuffer_spec.lua
+++ b/spec/util_dbuffer_spec.lua
@@ -46,6 +46,13 @@ describe("util.dbuffer", function ()
end);
end);
+ describe(":collapse()", function ()
+ it("works on an empty buffer", function ()
+ local b = dbuffer.new();
+ b:collapse();
+ end);
+ end);
+
describe(":sub", function ()
-- Helper function to compare buffer:sub() with string:sub()
local s = "hello world";
@@ -106,5 +113,10 @@ describe("util.dbuffer", function ()
local r = { b:byte(1, 2) };
assert.same({ 0, 140 }, r);
end);
+
+ it("works on an empty buffer", function ()
+ local b = dbuffer.new();
+ assert.equal("", b:sub(1,1));
+ end);
end);
end);