fix `get-bytevector-all' bug

Closes PR 12327
This commit is contained in:
Matthew Flatt 2011-11-01 09:10:14 -06:00
parent e361acae0b
commit 8d91efcee4
2 changed files with 8 additions and 1 deletions

View File

@ -643,7 +643,10 @@
(raise-type-error 'get-bytevector-all "binary port" p))
(let ([p2 (open-output-bytes)])
(copy-port p p2)
(get-output-bytes p2 #t)))
(let ([s (get-output-bytes p2 #t)])
(if (zero? (bytes-length s))
eof
s))))
;; ----------------------------------------

View File

@ -382,6 +382,10 @@
(test-transcoders bytevector->string-via-file
string->bytevector-via-file))
(let ((port (open-bytevector-input-port #vu8())))
(test (eof-object? (get-bytevector-all port)) #t)
(test (eof-object? (get-bytevector-n port 10)) #t))
(let ([test-i+o
(lambda (buf)
(let ([p (open-file-input/output-port "io-tmp1"