gui/gui-lib/mrlib/private/aligned-pasteboard/tests/test-macro.rkt
2014-12-02 02:33:07 -05:00

13 lines
443 B
Racket

#lang racket/base
(provide test)
;; test: (lambda (a?) ((a? a? . -> . boolean?) a? a? . -> . (void))
;; tests to see if the expression is true and prints and error if it's not
(define-syntax test
(syntax-rules (identity)
[(_ = actual expected)
(let ([result (with-handlers ([exn? (λ (x) x)]) actual)])
(unless (and (not (exn? result)) (= result expected))
(eprintf "test failed: ~s != ~s\n" result expected)))]))