aboutsummaryrefslogtreecommitdiffstats
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
commite21429d8e4533f765072f432b138a68092dab3fa (patch)
tree45fc7f4a411e31a4dafd5b9dcd20df070d90378c
parent33d00845e771884c54d6e1631646e60a2bb9c6ef (diff)
downloadprosody-e21429d8e4533f765072f432b138a68092dab3fa.tar.gz
prosody-e21429d8e4533f765072f432b138a68092dab3fa.zip
util.dbuffer: Add failing test case involving :sub after :discard
-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"));