mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-05 06:50:21 +02:00
R6RS: Have get-char',
get-line', etc. raise an `&i/o-decoding-error'.
* module/rnrs/io/ports.scm (&i/o-decoding): New error condition type. (with-i/o-decoding-error): New macro. (get-char, get-datum, get-line, get-string-all, lookahead-char): Use it. * test-suite/tests/r6rs-ports.test ("8.2.6 Input and output ports")["transcoded-port [error handling mode = raise]"]: Use `guard' and `i/o-decoding-error?'.
This commit is contained in:
parent
b8fff11ed9
commit
b1e76e8f2c
2 changed files with 37 additions and 14 deletions
|
@ -22,6 +22,7 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (rnrs io ports)
|
||||
#:use-module (rnrs exceptions)
|
||||
#:use-module (rnrs bytevectors))
|
||||
|
||||
;;; All these tests assume Guile 1.8's port system, where characters are
|
||||
|
@ -542,13 +543,9 @@
|
|||
(error-handling-mode raise)))
|
||||
(b (open-bytevector-input-port #vu8(255 2 1)))
|
||||
(tp (transcoded-port b t)))
|
||||
;; FIXME: Should be (guard (c ((i/o-decoding-error? c) #t)) ...).
|
||||
(catch 'decoding-error
|
||||
(lambda ()
|
||||
(get-line tp)
|
||||
#f)
|
||||
(lambda _
|
||||
#t))))
|
||||
(guard (c ((i/o-decoding-error? c)
|
||||
(eq? (i/o-error-port c) tp)))
|
||||
(get-line tp))))
|
||||
|
||||
(pass-if "transcoded-port [error handling mode = replace]"
|
||||
(let* ((t (make-transcoder (utf-8-codec) (native-eol-style)
|
||||
|
@ -559,4 +556,5 @@
|
|||
|
||||
;;; Local Variables:
|
||||
;;; mode: scheme
|
||||
;;; eval: (put 'guard 'scheme-indent-function 1)
|
||||
;;; End:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue