Fix failure to comply with a requirement of stdlib `io.Reader` docs: `When
Read encounters an error or end-of-file condition after successfully reading
n > 0 bytes, it returns the number of bytes read.`
Prepare a platform for unit tests and test the affected case.
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>