From 2f730f479cb3dd3ecd7f5af08aa7736ccfb02e98 Mon Sep 17 00:00:00 2001 From: Jon Rafkind Date: Wed, 6 Oct 2010 11:09:56 -0600 Subject: [PATCH] add keyword argument to eli-tester that allows for silent successes --- collects/tests/eli-tester.rkt | 41 ++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/collects/tests/eli-tester.rkt b/collects/tests/eli-tester.rkt index fb2000e1e8..8c47e297ea 100644 --- a/collects/tests/eli-tester.rkt +++ b/collects/tests/eli-tester.rkt @@ -62,12 +62,12 @@ [prefix (continuation-mark-set->list (current-continuation-marks) failure-prefix-mark)]) (error 'loc "~a" (form prefix 'e fmt arg ...))))) - (define (t1 x) + (define (test-1 x) #`(let ([x (safe #,x)]) (unless (and (eq? 'values (car x)) (= 2 (length x)) (cadr x)) #,(blame x "expected: non-#f single value\n got: ~a" #'(show x))))) - (define (t2 x y [eval2? #t]) + (define (test-2 x y [eval2? #t]) #`(let* ([x (safe #,x)] [xtag (car x)] [y #,(if eval2? #`(safe #,y) y)] [ytag (car y)]) (cond @@ -96,13 +96,13 @@ #,(blame x "bad error message, expected ~a: ~s\ngot: ~s" "an exception satisfying" #'yerr #'xerr))] [else (error 'test "bad error specification: ~e" yerr)]))]))) - (define (te x y) (t2 x #`(list 'error #,y #f) #f)) + (define (test-error x y) (test-2 x #`(list 'error #,y #f) #f)) (define (try t . args) #`(let ([c (test-context)]) (with-handlers ([exn? (lambda (e) (set-mcdr! c (cons e (mcdr c))))]) (set-mcar! c (add1 (mcar c))) #,(apply t args)))) - (define (tb x) x) + (define (test-0 x) x) (let loop ([xs (map (lambda (x) (let ([e (syntax-e x)]) (if (or (memq e '(do => <= =error> y r) (cons (try t2 x y) r)] - [(list* y '<= x r) (cons (try t2 x y) r)] - [(list* x '=error> y r) (cons (try te x y) r)] - [(list* y ' y r) (cons (try test-2 x y) r)] + [(list* y '<= x r) (cons (try test-2 x y) r)] + [(list* x '=error> y r) (cons (try test-error x y) r)] + [(list* y '