Make `substitute' conversion strategy test portable.
[bpt/guile.git] / test-suite / tests / foreign.test
index 14fad09..60d8630 100644 (file)
       (with-fluids ((%default-port-conversion-strategy 'error))
         (string->pointer s "ISO-8859-1"))))
 
-  (pass-if "%default-port-conversion-strategy is soft"
+  (pass-if "%default-port-conversion-strategy is escape"
     (let ((s "teĥniko"))
-      (equal? (map (lambda (strategy)
-                     (with-fluids ((%default-port-conversion-strategy strategy))
-                       (pointer->string (string->pointer s "ISO-8859-1"))))
-                   '(substitute escape))
-              (list "te?niko"
-                    (format #f "te\\u~4,'0xniko"
-                            (char->integer #\ĥ))))))
+      (equal? (with-fluids ((%default-port-conversion-strategy 'escape))
+                (pointer->string (string->pointer s "ISO-8859-1")))
+              (format #f "te\\u~4,'0xniko"
+                      (char->integer #\ĥ)))))
+
+  (pass-if "%default-port-conversion-strategy is substitute"
+    (let ((s "teĥniko")
+          (member (negate (negate member))))
+      (member (with-fluids ((%default-port-conversion-strategy 'substitute))
+                (pointer->string (string->pointer s "ISO-8859-1")))
+              '("te?niko"
+
+                ;; This form is found on FreeBSD 8.2 and Darwin 10.8.0.
+                "te^hniko"))))
 
   (pass-if "bijection"
     (let ((s "hello, world"))