mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
1999-08-04 Gary Houston <ghouston@easynet.co.uk>
* tests/ports.test: tests for buffered and unbuffered input/output fports with seeking.
This commit is contained in:
parent
265e6a4d28
commit
7c03500990
2 changed files with 45 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
1999-08-04 Gary Houston <ghouston@easynet.co.uk>
|
||||
|
||||
* tests/ports.test: tests for buffered and unbuffered input/output
|
||||
fports with seeking.
|
||||
|
||||
1999-08-01 Jim Blandy <jimb@savonarola.red-bean.com>
|
||||
|
||||
* tests/r4rs.test (SECTION 3 4): Each element of type-matrix
|
||||
|
|
|
@ -75,6 +75,46 @@
|
|||
(equal? string in-string)))
|
||||
(delete-file filename)))
|
||||
|
||||
;;; Buffered input/output port with seeking.
|
||||
(catch-test-errors
|
||||
(let* ((filename (test-file))
|
||||
(port (open-file filename "w+")))
|
||||
(display "J'Accuse" port)
|
||||
(lseek port -1 SEEK_CUR)
|
||||
(pass-if "file: r/w 1"
|
||||
(char=? (read-char port) #\e))
|
||||
(pass-if "file: r/w 2"
|
||||
(eof-object? (read-char port)))
|
||||
(lseek port -1 SEEK_CUR)
|
||||
(write-char #\x port)
|
||||
(lseek port 7 SEEK_SET)
|
||||
(pass-if "file: r/w 3"
|
||||
(char=? (read-char port) #\x))
|
||||
(lseek port -2 SEEK_END)
|
||||
(pass-if "file: r/w 4"
|
||||
(char=? (read-char port) #\s))
|
||||
(delete-file filename)))
|
||||
|
||||
;;; Unbuffered input/output port with seeking.
|
||||
(catch-test-errors
|
||||
(let* ((filename (test-file))
|
||||
(port (open-file filename "w+0")))
|
||||
(display "J'Accuse" port)
|
||||
(lseek port -1 SEEK_CUR)
|
||||
(pass-if "file: ub r/w 1"
|
||||
(char=? (read-char port) #\e))
|
||||
(pass-if "file: ub r/w 2"
|
||||
(eof-object? (read-char port)))
|
||||
(lseek port -1 SEEK_CUR)
|
||||
(write-char #\x port)
|
||||
(lseek port 7 SEEK_SET)
|
||||
(pass-if "file: ub r/w 3"
|
||||
(char=? (read-char port) #\x))
|
||||
(lseek port -2 SEEK_END)
|
||||
(pass-if "file: ub r/w 4"
|
||||
(char=? (read-char port) #\s))
|
||||
(delete-file filename)))
|
||||
|
||||
|
||||
;;;; Pipe ports.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue