| 1 |
;;;; srfi-88.test --- SRFI-88. -*- mode: scheme; coding: utf-8; -*- |
| 2 |
;;;; Ludovic Courtès <[email protected]> |
| 3 |
;;;; |
| 4 |
;;;; Copyright (C) 2008, 2010 Free Software Foundation, Inc. |
| 5 |
;;;; |
| 6 |
;;;; This library is free software; you can redistribute it and/or |
| 7 |
;;;; modify it under the terms of the GNU Lesser General Public |
| 8 |
;;;; License as published by the Free Software Foundation; either |
| 9 |
;;;; version 3 of the License, or (at your option) any later version. |
| 10 |
;;;; |
| 11 |
;;;; This library is distributed in the hope that it will be useful, |
| 12 |
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
;;;; Lesser General Public License for more details. |
| 15 |
;;;; |
| 16 |
;;;; You should have received a copy of the GNU Lesser General Public |
| 17 |
;;;; License along with this library; if not, write to the Free Software |
| 18 |
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 |
|
| 20 |
(define-module (test-srfi-88) |
| 21 |
:use-module (test-suite lib) |
| 22 |
:use-module (srfi srfi-88)) |
| 23 |
|
| 24 |
|
| 25 |
;; Most of the test cases are taken from SRFI-88. |
| 26 |
|
| 27 |
(with-test-prefix "srfi-88" |
| 28 |
|
| 29 |
(pass-if "cond-expand" |
| 30 |
(cond-expand (srfi-88 #t) |
| 31 |
(else #f))) |
| 32 |
|
| 33 |
(pass-if "keyword?" |
| 34 |
(and (keyword? 'foo:) |
| 35 |
(keyword? foo:) |
| 36 |
(not (keyword? 'foo)) |
| 37 |
(not (keyword? ':)) |
| 38 |
(keyword? (car '(a: b:))) |
| 39 |
(not (keyword? "bar")))) |
| 40 |
|
| 41 |
(pass-if "keyword->string" |
| 42 |
(and (string=? (keyword->string foo:) "foo") |
| 43 |
(string=? "a b c" |
| 44 |
(keyword->string (string->keyword "a b c"))))) |
| 45 |
|
| 46 |
(pass-if "string->keyword" |
| 47 |
(eq? (string->keyword "foo") foo:)) |
| 48 |
|
| 49 |
(pass-if "empty keyword" |
| 50 |
;; XXX: We don't currently support syntax of the form |
| 51 |
;; `#{extended symbol}#:'. |
| 52 |
(string=? "" |
| 53 |
(keyword->string (string->keyword ""))))) |