5am fixtures pasted by certainty on Wed Mar 7 15:19:10 2012
(def-fixture my-fixture (setup-some-context) &body)) (with-fixture my-fixture (do-the-actual-work))
maybe something like that pasted by certainty on Wed Mar 7 15:33:46 2012
(define (call-with-fixture fixture proc) (fixture proc)) (define-syntax with-fixture (syntax-rules () ((_ fixture-name code more-code ...) (call-with-fixture fixture-name (lambda () code more-code ...))))) (define (my-fixture body) (print "Before") (body) (print "After")) (with-fixture my-fixture (print "I do something"))
even shorter pasted by certainty on Wed Mar 7 15:38:14 2012
(define-syntax with-fixture (syntax-rules () ((_ fixture-name code more-code ...) (fixture-name (lambda () code more-code ...))))) (define (my-fixture body) (print "Before") (body) (print "After")) (with-fixture my-fixture (print "I do something"))
with variables from within the fixtures added by certainty on Wed Mar 7 15:42:28 2012
(define-syntax with-fixture (syntax-rules () ((_ (fixture-name args ...) code more-code ...) (fixture-name (lambda (args ...) code more-code ...))))) (define (my-fixture body) (print "Before") (body 10) (print "After")) (with-fixture (my-fixture value-from-fixture) (printf "I do something with ~A~%" value-from-fixture))