1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

net: fix socket.read_line with long lines #6842

This commit is contained in:
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

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
}