--- a/spec/util_dbuffer_spec.lua Sun Jun 28 15:58:47 2020 +0200
+++ b/spec/util_dbuffer_spec.lua Mon Jun 29 12:51:28 2020 +0100
@@ -21,6 +21,21 @@
end);
end);
+ describe(":read", function ()
+ it("supports optional bytes parameter", function ()
+ -- should return the frontmost chunk
+ local b = dbuffer.new();
+ assert.truthy(b:write("hello"));
+ assert.truthy(b:write(" "));
+ assert.truthy(b:write("world"));
+ assert.equal("h", b:read(1));
+
+ assert.equal("ello", b:read());
+ assert.equal(" ", b:read());
+ assert.equal("world", b:read());
+ end);
+ end);
+
describe(":discard", function ()
local b = dbuffer.new();
it("works", function ()