aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2021-06-29 14:25:57 +0100
committerMatthew Wild <mwild1@gmail.com>2021-06-29 14:25:57 +0100
commite21e4b2b2496ffcc5d620b04cf3e01b71e9982b1 (patch)
tree8ab54137d7e92c3eea86888d47a9c38567de40f7 /spec
parent4e56658eb3564a41d1014e5ee89cd01c8004252e (diff)
downloadprosody-e21e4b2b2496ffcc5d620b04cf3e01b71e9982b1.tar.gz
prosody-e21e4b2b2496ffcc5d620b04cf3e01b71e9982b1.zip
util.dbuffer: Fix bugs, remove multi-char support (more complex than first thought)
Character sequences could be split across chunk boundaries. Would require a bunch of code to make that work reliably. Only apply front_consumed on first chunk, and adjust buffer_pos accordingly.
Diffstat (limited to 'spec')
-rw-r--r--spec/util_dbuffer_spec.lua21
1 files changed, 0 insertions, 21 deletions
diff --git a/spec/util_dbuffer_spec.lua b/spec/util_dbuffer_spec.lua
index aa31da55..83ca1823 100644
--- a/spec/util_dbuffer_spec.lua
+++ b/spec/util_dbuffer_spec.lua
@@ -57,27 +57,6 @@ describe("util.dbuffer", function ()
assert.equal(nil, b:read_until("\n"));
assert.equal("and more", b:read_chunk());
end);
-
- it("works with multi-character sequences", function ()
- local b = dbuffer.new();
- b:write("hello\r\n");
- b:write("world");
- b:write("\r\n");
- b:write("\r\n\r\n");
- b:write("stuff");
- b:write("more\r\nand more");
-
- assert.equal(nil, b:read_until("."));
- assert.equal(nil, b:read_until("%"));
- assert.equal("hello\r\n", b:read_until("\r\n"));
- assert.equal("world\r\n", b:read_until("\r\n"));
- assert.equal("\r\n", b:read_until("\r\n"));
- assert.equal("\r\n", b:read_until("\r\n"));
- assert.equal("stu", b:read(3));
- assert.equal("ffmore\r\n", b:read_until("\r\n"));
- assert.equal(nil, b:read_until("\r\n"));
- assert.equal("and more", b:read_chunk());
- end);
end);
describe(":discard", function ()