X-Git-Url: https://git.hcoop.net/bpt/guile.git/blobdiff_plain/a3d7d5d50806fdfb80f44f53c7d990cf79a8d566..d21ef2683860561e7b7fdcf2e4ab5523ea320534:/test-suite/tests/encoding-utf8.test diff --git a/test-suite/tests/encoding-utf8.test b/test-suite/tests/encoding-utf8.test index b82994c3a..786170ed9 100644 --- a/test-suite/tests/encoding-utf8.test +++ b/test-suite/tests/encoding-utf8.test @@ -1,6 +1,6 @@ ;;;; encoding-utf8.test --- test suite for Guile's string encodings -*- mode: scheme; coding: utf-8 -*- ;;;; -;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. +;;;; Copyright (C) 2009, 2010, 2014 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -24,9 +24,8 @@ (define (string-ints . args) (apply string (map integer->char args))) -(define oldlocale #f) -(if (defined? 'setlocale) - (set! oldlocale (setlocale LC_ALL ""))) +(when (defined? 'setlocale) + (setlocale LC_ALL "")) (define ascii-a (integer->char 65)) ; LATIN CAPITAL LETTER A (define a-acute (integer->char #x00c1)) ; LATIN CAPITAL LETTER A WITH ACUTE @@ -94,6 +93,14 @@ (string=? "#\\Á" (get-output-string pt)))) + (pass-if "write A followed by combining accent" + (let ((pt (open-output-string))) + (set-port-encoding! pt "UTF-8") + (set-port-conversion-strategy! pt 'escape) + (write (string #\A (integer->char #x030f)) pt) + (string-ci=? "\"Ȁ\"" + (get-output-string pt)))) + (pass-if "write alpha" (let ((pt (open-output-string))) (set-port-encoding! pt "UTF-8") @@ -118,16 +125,16 @@ (with-test-prefix "string length" (pass-if "última" - (eq? (string-length s1) 6)) + (eqv? (string-length s1) 6)) (pass-if "cédula" - (eq? (string-length s2) 6)) + (eqv? (string-length s2) 6)) (pass-if "años" - (eq? (string-length s3) 4)) + (eqv? (string-length s3) 4)) (pass-if "羅生門" - (eq? (string-length s4) 3))) + (eqv? (string-length s4) 3))) (with-test-prefix "internal encoding" @@ -180,7 +187,4 @@ (pass-if "1" (let ((芥川龍之介 1) (ñ 2)) - (eq? (+ 芥川龍之介 ñ) 3)))) - -(if (defined? 'setlocale) - (setlocale LC_ALL oldlocale)) + (eqv? (+ 芥川龍之介 ñ) 3))))