From f47c2468bb62ba83a53d1e4b13cafe2adf723522 Mon Sep 17 00:00:00 2001 From: Takahiro Yaota Date: Fri, 20 Nov 2020 23:24:41 +0900 Subject: [PATCH] net: fix socket.read_line with long lines #6842 --- vlib/net/tcp_simple_client_server_test.v | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vlib/net/tcp_simple_client_server_test.v b/vlib/net/tcp_simple_client_server_test.v index e8fdb2762e..de4abc41c7 100644 --- a/vlib/net/tcp_simple_client_server_test.v +++ b/vlib/net/tcp_simple_client_server_test.v @@ -134,3 +134,21 @@ fn test_socket_write_fail_without_panic() { } } } + +fn test_socket_read_line_long_line_without_eol() { + server, client, socket := setup() + mut reader := io.new_buffered_reader({ + reader: io.make_reader(client) + }) + defer { + cleanup(server, client, socket) + } + message := strings.repeat_string('123', 400) + socket.write_str(message) + socket.write_str('\n') + line := reader.read_line() or { + assert false + return + } + assert line == message +}