summaryrefslogtreecommitdiff
path: root/test-suite/tests/ports.test
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite/tests/ports.test')
-rw-r--r--test-suite/tests/ports.test17
1 files changed, 17 insertions, 0 deletions
diff --git a/test-suite/tests/ports.test b/test-suite/tests/ports.test
index ce796d11e..338741f49 100644
--- a/test-suite/tests/ports.test
+++ b/test-suite/tests/ports.test
@@ -150,6 +150,23 @@
(string=? line test-string)))
(delete-file filename)))
+;;; ungetting characters and strings.
+(catch-test-errors
+ (with-input-from-string "walk on the moon\nmoon"
+ (lambda ()
+ (read-char)
+ (unread-char #\a (current-input-port))
+ (pass-if "unread-char"
+ (char=? (read-char) #\a))
+ (read-line)
+ (let ((replacenoid "chicken enchilada"))
+ (unread-char #\newline (current-input-port))
+ (unread-string replacenoid (current-input-port))
+ (pass-if "unread-string"
+ (string=? (read-line) replacenoid)))
+ (pass-if "unread residue"
+ (string=? (read-line) "moon")))))
+
;;;; Pipe ports.