Software /
code /
prosody
Diff
spec/util_dbuffer_spec.lua @ 11044:7b720a815519
util.dbuffer: Add failing test case involving :sub after :discard
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 24 Aug 2020 17:07:37 +0200 |
parent | 11028:d7a403060946 |
child | 11045:8c6bace13229 |
line wrap: on
line diff
--- a/spec/util_dbuffer_spec.lua Sun Aug 23 22:19:29 2020 +0200 +++ b/spec/util_dbuffer_spec.lua Mon Aug 24 17:07:37 2020 +0200 @@ -67,6 +67,15 @@ 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"));