* tests/ports.test ("line counter"): Verify that we do eventually
authorJim Blandy <jimb@red-bean.com>
Wed, 9 Jun 1999 09:42:15 +0000 (09:42 +0000)
committerJim Blandy <jimb@red-bean.com>
Wed, 9 Jun 1999 09:42:15 +0000 (09:42 +0000)
get EOF on the port --- don't just read forever.

test-suite/tests/ports.test

index 4b6ab50..c36e3b4 100644 (file)
                      (equal? (read-line port) second-line))
             (pass-if "read-line increments line number"
                      (= (port-line port) 2))
-            (let loop ()
-              (if (not (eof-object? (read-line port)))
-                  (loop)))
+            (pass-if "read-line returns EOF"
+                     (let loop ((i 0))
+                       (cond
+                        ((eof-object? (read-line port)) #t)
+                        ((> i 20) #f)
+                        (else (loop (+ i 1))))))
             (pass-if "line count is 5 at EOF"
                      (= (port-line port) 5))))
         ports port-list-names)