;;;; colorized.test --- test (ice-9 colorized) module -*- scheme -*- ;;;; ;;;; Copyright 2013 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 ;;;; License as published by the Free Software Foundation; either ;;;; version 3 of the License, or (at your option) any later version. ;;;; ;;;; This library is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; Lesser General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU Lesser General Public ;;;; License along with this library; if not, write to the Free Software ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA (define-module (test-suite test-ice-9-colorized) #:use-module (test-suite lib) #:use-module (oop goops) #:use-module (srfi srfi-9) #:use-module (ice-9 colorized)) ;; colorized-REPL test printer (define (color-it-test color str control) str) ;;; ;;; colorzed object test ;;; (define-record-type aaa (make-aaa a) aaa? (a a)) (define (test-me obj info) (parameterize ((color-func color-it-test)) (pass-if info (equal? (call-with-output-string (lambda (port) (colorize obj port))) (object->string obj))))) (with-test-prefix "colorized object tests" (test-me 123 "integer") (test-me #\c "char") (test-me "hello world\n" "string") (test-me '(1 2 3 4 5) "list") (test-me (cons 1 2) "pair") (test-me "class") (test-me + "procedure") (test-me (vector 1 2 3) "vector") (test-me #:test-me "keyword") (test-me char-set:ascii "char-set") (test-me 'test-me "symbol") (test-me (make-stack #t) "stack") (test-me aaa "record-type") (test-me 1.2 "inexact") (test-me 1/2 "exact") (test-me (make-regexp "[0-9]*") "regexp") (test-me (make-bitvector 8) "bitvector") (test-me address@hidden@3((1 2) (3 4)) "array") (test-me #f "boolean false") (test-me #t "boolean true") (test-me 3+4i "complex") (test-me (make-hash-table) "hash table") (test-me (make-hook) "hook"))