This repository has been archived on 2022-08-10. You can view files and clone it, but cannot push or open issues or pull requests.
chez-openbsd/nanopass/tests/unit-test-helpers-implementation.ikarus.sls

30 lines
1.1 KiB
Text
Raw Normal View History

2022-07-29 15:12:07 +02:00
;;; Copyright (c) 2000-2015 Andrew W. Keep, R. Kent Dybvig
;;; See the accompanying file Copyright for details
(library (tests unit-test-helpers-implementation)
(export with-output-to-string display-condition format-error-message)
(import (ikarus))
(define display-condition
(case-lambda
[(c) (display-condition c (current-output-port))]
[(c op)
(display
(format "~a~a~a~a~a"
(if (warning? c) "Warning" "Exception")
(if (who-condition? c) (format " in ~s" (condition-who c)) "")
(if (message-condition? c) (format ": ~a" (condition-message c)) "")
(if (and (irritants-condition? c) (not (null? (condition-irritants c))))
(format " with irritants ~s" (condition-irritants c))
"")
(if (syntax-violation? c)
(if (syntax-violation-subform c)
(format "~s in ~s" (syntax-violation-subform c) (syntax-violation-form c))
(format "~s" (syntax-violation-form c)))
""))
op)]))
(define-syntax format-error-message
(syntax-rules ()
[(_ args ...) (format args ...)])))