# HG changeset patch # User Kim Alvefur # Date 1598281657 -7200 # Node ID 7b720a81551946226cd400da2199fa72b6df8184 # Parent d105e787f5ed0c10169d87e1c96a83a9328d0ebf util.dbuffer: Add failing test case involving :sub after :discard diff -r d105e787f5ed -r 7b720a815519 spec/util_dbuffer_spec.lua --- 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"));