From 3b10623badd228e1cd85d36d5273fff8abb734fa Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 20 Feb 2007 01:42:25 +0000 Subject: [PATCH] tests for mz and port.ss repairs svn: r5641 --- collects/tests/mzscheme/port.ss | 5 +++++ collects/tests/mzscheme/portlib.ss | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/collects/tests/mzscheme/port.ss b/collects/tests/mzscheme/port.ss index c1791c7111..e3306592cd 100644 --- a/collects/tests/mzscheme/port.ss +++ b/collects/tests/mzscheme/port.ss @@ -64,6 +64,11 @@ (test-file #f) (test-file #t)) +(let-values ([(r w) (make-pipe)]) + (write-byte 200 w) + (test #t byte-ready? r) + (test #f char-ready? r)) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Based on the MzScheme manual... diff --git a/collects/tests/mzscheme/portlib.ss b/collects/tests/mzscheme/portlib.ss index 530a32a672..771327ad51 100644 --- a/collects/tests/mzscheme/portlib.ss +++ b/collects/tests/mzscheme/portlib.ss @@ -297,6 +297,18 @@ (test #\u7238 read p) (test 'lo read p)) +;; Check that make-input-port/read-to-peek isn't trying +;; to use chars when it should use bytes: +(let-values ([(pipe-r pipe-w) (make-pipe)]) + (write-byte 200 pipe-w) + (let ([p (make-input-port/read-to-peek 'name + (lambda (s) + (read-bytes-avail!* s pipe-r)) + #f + void)]) + (test 200 peek-byte p) + (test 200 read-byte p))) + ;; read synchronization events (define (go mk-hello sync atest btest) (test #t list? (list mk-hello sync atest btest))