aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-08-24 17:07:37 +0200
committerKim Alvefur <zash@zash.se>2020-08-24 17:07:37 +0200
commit7c21a741466febdb5a9731531f89398c4994f27b (patch)
tree45fc7f4a411e31a4dafd5b9dcd20df070d90378c /spec
parent2238804d7aece8e7a64e03f822b5106f932ea683 (diff)
downloadprosody-7c21a741466febdb5a9731531f89398c4994f27b.tar.gz
prosody-7c21a741466febdb5a9731531f89398c4994f27b.zip
util.dbuffer: Add failing test case involving :sub after :discard
Diffstat (limited to 'spec')
-rw-r--r--spec/util_dbuffer_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/util_dbuffer_spec.lua b/spec/util_dbuffer_spec.lua
index b7f80dc9..26fa7da6 100644
--- a/spec/util_dbuffer_spec.lua
+++ b/spec/util_dbuffer_spec.lua
@@ -67,6 +67,15 @@ describe("util.dbuffer", function ()
assert.equals("hello", b:sub(1, 5));
end);
+ pending("works after discard", function ()
+ local b = dbuffer.new(256);
+ assert.truthy(b:write("foo"));
+ assert.truthy(b:write("bar"));
+ assert.equals("foobar", b:sub(1, 6));
+ assert.truthy(b:discard(3)) -- until the space
+ assert.equals("bar", b:sub(1, 3));
+ end);
+
it("supports optional end parameter", function ()
local b = dbuffer.new();
assert.truthy(b:write("hello world"));