1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00

(port-column): Further tests, of new \a \b \r.

This commit is contained in:
Kevin Ryde 2004-09-08 01:20:52 +00:00
parent 1e35a229f0
commit 7424deab5d

View file

@ -422,6 +422,123 @@
"no newline here")
15)
(with-test-prefix "port-column"
(with-test-prefix "output"
(pass-if "x"
(let ((port (open-output-string)))
(display "x" port)
(= 1 (port-column port))))
(pass-if "\\a"
(let ((port (open-output-string)))
(display "\a" port)
(= 0 (port-column port))))
(pass-if "x\\a"
(let ((port (open-output-string)))
(display "x\a" port)
(= 1 (port-column port))))
(pass-if "\\x08 backspace"
(let ((port (open-output-string)))
(display "\x08" port)
(= 0 (port-column port))))
(pass-if "x\\x08 backspace"
(let ((port (open-output-string)))
(display "x\x08" port)
(= 0 (port-column port))))
(pass-if "\\n"
(let ((port (open-output-string)))
(display "\n" port)
(= 0 (port-column port))))
(pass-if "x\\n"
(let ((port (open-output-string)))
(display "x\n" port)
(= 0 (port-column port))))
(pass-if "\\r"
(let ((port (open-output-string)))
(display "\r" port)
(= 0 (port-column port))))
(pass-if "x\\r"
(let ((port (open-output-string)))
(display "x\r" port)
(= 0 (port-column port))))
(pass-if "\\t"
(let ((port (open-output-string)))
(display "\t" port)
(= 8 (port-column port))))
(pass-if "x\\t"
(let ((port (open-output-string)))
(display "x\t" port)
(= 8 (port-column port)))))
(with-test-prefix "input"
(pass-if "x"
(let ((port (open-input-string "x")))
(while (not (eof-object? (read-char port))))
(= 1 (port-column port))))
(pass-if "\\a"
(let ((port (open-input-string "\a")))
(while (not (eof-object? (read-char port))))
(= 0 (port-column port))))
(pass-if "x\\a"
(let ((port (open-input-string "x\a")))
(while (not (eof-object? (read-char port))))
(= 1 (port-column port))))
(pass-if "\\x08 backspace"
(let ((port (open-input-string "\x08")))
(while (not (eof-object? (read-char port))))
(= 0 (port-column port))))
(pass-if "x\\x08 backspace"
(let ((port (open-input-string "x\x08")))
(while (not (eof-object? (read-char port))))
(= 0 (port-column port))))
(pass-if "\\n"
(let ((port (open-input-string "\n")))
(while (not (eof-object? (read-char port))))
(= 0 (port-column port))))
(pass-if "x\\n"
(let ((port (open-input-string "x\n")))
(while (not (eof-object? (read-char port))))
(= 0 (port-column port))))
(pass-if "\\r"
(let ((port (open-input-string "\r")))
(while (not (eof-object? (read-char port))))
(= 0 (port-column port))))
(pass-if "x\\r"
(let ((port (open-input-string "x\r")))
(while (not (eof-object? (read-char port))))
(= 0 (port-column port))))
(pass-if "\\t"
(let ((port (open-input-string "\t")))
(while (not (eof-object? (read-char port))))
(= 8 (port-column port))))
(pass-if "x\\t"
(let ((port (open-input-string "x\t")))
(while (not (eof-object? (read-char port))))
(= 8 (port-column port))))))
;;;; testing read-delimited and friends
(with-test-prefix "read-delimited!"