aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_dbuffer_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/util_dbuffer_spec.lua')
-rw-r--r--spec/util_dbuffer_spec.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/util_dbuffer_spec.lua b/spec/util_dbuffer_spec.lua
index 2b1af835..83ca1823 100644
--- a/spec/util_dbuffer_spec.lua
+++ b/spec/util_dbuffer_spec.lua
@@ -36,6 +36,29 @@ describe("util.dbuffer", function ()
end);
end);
+ describe(":read_until", function ()
+ it("works", function ()
+ local b = dbuffer.new();
+ b:write("hello\n");
+ b:write("world");
+ b:write("\n");
+ b:write("\n\n");
+ b:write("stuff");
+ b:write("more\nand more");
+
+ assert.equal(nil, b:read_until("."));
+ assert.equal(nil, b:read_until("%"));
+ assert.equal("hello\n", b:read_until("\n"));
+ assert.equal("world\n", b:read_until("\n"));
+ assert.equal("\n", b:read_until("\n"));
+ assert.equal("\n", b:read_until("\n"));
+ assert.equal("stu", b:read(3));
+ assert.equal("ffmore\n", b:read_until("\n"));
+ assert.equal(nil, b:read_until("\n"));
+ assert.equal("and more", b:read_chunk());
+ end);
+ end);
+
describe(":discard", function ()
local b = dbuffer.new();
it("works", function ()