Commit | Line | Data |
---|---|---|
a5229ee8 | 1 | ;;;; encoding-iso88591.test --- test suite for Guile's string encodings -*- mode: scheme; coding: iso-8859-1 -*- |
889975e5 | 2 | ;;;; |
a3d7d5d5 | 3 | ;;;; Copyright (C) 2009, 2010 Free Software Foundation, Inc. |
a5229ee8 LC |
4 | ;;;; |
5 | ;;;; This library is free software; you can redistribute it and/or | |
6 | ;;;; modify it under the terms of the GNU Lesser General Public | |
7 | ;;;; License as published by the Free Software Foundation; either | |
8 | ;;;; version 3 of the License, or (at your option) any later version. | |
9 | ;;;; | |
10 | ;;;; This library is distributed in the hope that it will be useful, | |
889975e5 | 11 | ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
a5229ee8 LC |
12 | ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | ;;;; Lesser General Public License for more details. | |
14 | ;;;; | |
15 | ;;;; You should have received a copy of the GNU Lesser General Public | |
16 | ;;;; License along with this library; if not, write to the Free Software | |
17 | ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
889975e5 MG |
18 | |
19 | (define-module (test-strings) | |
20 | #:use-module (test-suite lib) | |
21 | #:use-module (srfi srfi-1)) | |
22 | ||
889975e5 MG |
23 | ;; Create a string from integer char values, eg. (string-ints 65) => "A" |
24 | (define (string-ints . args) | |
25 | (apply string (map integer->char args))) | |
26 | ||
ce3ed012 MG |
27 | ;; Set locale to the environment's locale, so that the prints look OK. |
28 | (define oldlocale #f) | |
29 | (if (defined? 'setlocale) | |
30 | (set! oldlocale (setlocale LC_ALL ""))) | |
889975e5 | 31 | |
bda0d85f MG |
32 | (define ascii-a (integer->char 65)) ; LATIN CAPITAL LETTER A |
33 | (define a-acute (integer->char #x00c1)) ; LATIN CAPITAL LETTER A WITH ACUTE | |
34 | (define alpha (integer->char #x03b1)) ; GREEK SMALL LETTER ALPHA | |
35 | (define cherokee-a (integer->char #x13a0)) ; CHEROKEE LETTER A | |
36 | ||
37 | (with-test-prefix "characters" | |
38 | (pass-if "input A" | |
39 | (char=? ascii-a #\A)) | |
40 | ||
41 | (pass-if "input A acute" | |
42 |