Simplify GOOPS effective method cache format
[bpt/guile.git] / test-suite / tests / encoding-utf8.test
index b82994c..786170e 100644 (file)
@@ -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
              (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")
 (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"
 
   (pass-if "1"
           (let ((芥川龍之介  1)
                 (ñ 2))
-            (eq? (+  芥川龍之介 ñ) 3))))
-
-(if (defined? 'setlocale)
-    (setlocale LC_ALL oldlocale))
+            (eqv? (+  芥川龍之介 ñ) 3))))