From cfe0a6f63589db8f6265f346b4dde154dc485a74 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Sat, 24 Jan 2015 13:35:49 +0900 Subject: [PATCH] Checking errors on reading/writing from/to closed ports. --- tests/r7rs-tests.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/r7rs-tests.scm b/tests/r7rs-tests.scm index 27703495..10b5fa48 100644 --- a/tests/r7rs-tests.scm +++ b/tests/r7rs-tests.scm @@ -1817,6 +1817,16 @@ (close-port out) (output-port-open? out))) +(test 'error + (let ((in (open-input-string "abc"))) + (close-input-port in) + (guard (exn (else 'error)) (read-char in)))) + +(test 'error + (let ((out (open-output-string))) + (close-output-port out) + (guard (exn (else 'error)) (write-char #\c out)))) + (test #t (eof-object? (eof-object))) (test #t (eof-object? (read (open-input-string "")))) (test #t (char-ready? (open-input-string "42")))