diff spec/util_dbuffer_spec.lua @ 11637:19cddf92fcc2

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.
author Matthew Wild <mwild1@gmail.com>
date Tue, 29 Jun 2021 14:25:57 +0100
parents 11e0a0a08da3
children bf6d2f9fad4d
line wrap: on
line diff
--- a/spec/util_dbuffer_spec.lua	Tue Jun 29 13:48:14 2021 +0100
+++ b/spec/util_dbuffer_spec.lua	Tue Jun 29 14:25:57 2021 +0100
@@ -57,27 +57,6 @@
 			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 ()