net: fix socket.read_line with long lines #6842

pull/6892/head
Takahiro Yaota 2020-11-20 23:24:41 +09:00 committed by GitHub
parent 82b16cbf45
commit f47c2468bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -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
}