From e21429d8e4533f765072f432b138a68092dab3fa Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 24 Aug 2020 17:07:37 +0200 Subject: util.dbuffer: Add failing test case involving :sub after :discard --- spec/util_dbuffer_spec.lua | 9 +++++++++ 1 file changed, 9 insertions(+) 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")); -- cgit v1.2.3