1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Make `substitute' conversion strategy test portable.

* test-suite/tests/foreign.test ("pointer<->string")["%default-port-conversion-strategy
  is soft"]: Split into the following tests.
  ["%default-port-conversion-strategy is escape",
  "%default-port-conversion-strategy is substitute"]: New tests.  In the
  latter, add the escape form returned on FreeBSD 8.2 and Darwin 10.8.0.
This commit is contained in:
Ludovic Courtès 2012-05-31 15:53:06 +02:00
parent d3a1a74cb8
commit 27ea5c3f31

View file

@ -167,15 +167,22 @@
(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"))