RE: make-test-suite with setup/teardown actions

Khorev Sergey <[email protected]>
Newsgroups gmane.lisp.scheme.plt.schematics
Message-ID <F1BE47CAD645D311A8F7006097AD0C81032F79D1@HERMES>
It seems, that make-test-suite+ can be further simplified

(define-syntax make-test-suite+
  (syntax-rules ()
    [(_ suite-name setup teardown test ...)
     (let make-suite-proc ([a-suit-name suite-name] 
                           [a-setup (lambda () setup)] 
                           [a-teardown (lambda () teardown)]
                           [tests (list test ...)])
       (apply make-test-suite
              a-suit-name
              (map 
               (lambda (t-case)
                 (match t-case
                   [($ test-case name action)
                    (make-test-case name (action) (a-setup) (a-teardown))]
                   [($ test-suite name tests) ;;; apply setup/teardown
recursively
                    (make-suite-proc name a-setup a-teardown tests)]))
               tests)))]))


-- 
Sergey Khorev
http://iamphet.nm.ru
The person whose clothes are extremely fine I am too apt to consider
as not being possessed of any superiority of fortune, but resembling
those Indians who are found to wear all the gold they have in the
world in a bob at the nose.
 -- Oliver Goldsmith 


-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.