Avoid 'with-latin1-locale' in binary I/O tests.
authorMark H Weaver <mhw@netris.org>
Fri, 19 Apr 2019 07:09:37 +0000 (03:09 -0400)
committerMark H Weaver <mhw@netris.org>
Tue, 7 May 2019 08:39:52 +0000 (04:39 -0400)
* 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.

test-suite/tests/r6rs-ports.test

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