1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

Avoid 'with-latin1-locale' in binary I/O tests.

* test-suite/tests/r6rs-ports.test ("put-bytevector [2 args]")
("put-bytevector [3 args]", "put-bytevector [4 args]"): Set the default
port encoding instead of setting the locale.
This commit is contained in:
Mark H Weaver 2019-04-19 03:09:37 -04:00 committed by Andy Wingo
parent 66ffd93dcf
commit c6692a4825

View file

@ -243,14 +243,13 @@
(put-u8 port 77) (put-u8 port 77)
(equal? (get-u8 port) 77))) (equal? (get-u8 port) 77)))
;; Note: The `put-bytevector' tests below require a Latin-1 locale so ;; Note: The `put-bytevector' tests below temporarily set the default
;; that the `scm_from_locale_stringn' call in `sf_write' will let all ;; port encoding to ISO-8859-1 so that the soft-port will let all the
;; the bytes through, unmodified. This is hacky, but we can't use ;; bytes through, unmodified. This is hacky, but we can't use "custom
;; "custom binary output ports" here because they're only tested ;; binary output ports" here because they're only tested later.
;; later.
(pass-if "put-bytevector [2 args]" (pass-if "put-bytevector [2 args]"
(with-latin1-locale (with-fluids ((%default-port-encoding "ISO-8859-1"))
(let ((port (make-soft-output-port)) (let ((port (make-soft-output-port))
(bv (make-bytevector 256))) (bv (make-bytevector 256)))
(put-bytevector port bv) (put-bytevector port bv)
@ -259,7 +258,7 @@
(get-bytevector-n port (bytevector-length bv))))))) (get-bytevector-n port (bytevector-length bv)))))))
(pass-if "put-bytevector [3 args]" (pass-if "put-bytevector [3 args]"
(with-latin1-locale (with-fluids ((%default-port-encoding "ISO-8859-1"))
(let ((port (make-soft-output-port)) (let ((port (make-soft-output-port))
(bv (make-bytevector 256)) (bv (make-bytevector 256))
(start 10)) (start 10))
@ -269,7 +268,7 @@
(get-bytevector-n port (- (bytevector-length bv) start))))))) (get-bytevector-n port (- (bytevector-length bv) start)))))))
(pass-if "put-bytevector [4 args]" (pass-if "put-bytevector [4 args]"
(with-latin1-locale (with-fluids ((%default-port-encoding "ISO-8859-1"))
(let ((port (make-soft-output-port)) (let ((port (make-soft-output-port))
(bv (make-bytevector 256)) (bv (make-bytevector 256))
(start 10) (start 10)