diff --git a/collects/rackunit/private/gui/gui.rkt b/collects/rackunit/private/gui/gui.rkt index 2904ac8c90..408c896cb5 100644 --- a/collects/rackunit/private/gui/gui.rkt +++ b/collects/rackunit/private/gui/gui.rkt @@ -40,8 +40,8 @@ (run-case case model) state) - (foldts for-suite-entry for-suite-exit for-case - #f test)) + (foldts-test-suite for-suite-entry for-suite-exit for-case + #f test)) ;; From old suite-runner: #| diff --git a/collects/rackunit/private/result.rkt b/collects/rackunit/private/result.rkt index fc5309ab66..54daab4353 100644 --- a/collects/rackunit/private/result.rkt +++ b/collects/rackunit/private/result.rkt @@ -33,7 +33,7 @@ (provide (all-defined-out)) -;; foldts : +;; foldts-test-suite : ;; (test-suite string thunk thunk 'a -> 'a) ;; (test-suite string thunk thunk 'a 'a -> 'a) ;; (test-case string thunk 'a -> 'a) @@ -49,7 +49,7 @@ ;; between OO and FP. FP gives up extensibility on ;; functions, OO on data. Here we want extensibility on ;; data so FP is a bit ugly]. -(define (foldts fdown fup fhere seed test) +(define (foldts-test-suite fdown fup fhere seed test) (cond ((rackunit-test-case? test) (fhere test @@ -61,7 +61,7 @@ (else (raise (make-exn:test - (format "foldts: Don't know what to do with ~a. It isn't a test case or test suite." test) + (format "foldts-test-suite: Don't know what to do with ~a. It isn't a test case or test suite." test) (current-continuation-marks)))))) @@ -87,7 +87,7 @@ #:run [run run-test-case] #:fdown [fdown 2nd-arg] #:fup [fup 2nd-arg]) - (foldts + (foldts-test-suite (lambda (suite name before after seed) '(printf "into ~a\n" name) (before) diff --git a/collects/rackunit/private/test.rkt b/collects/rackunit/private/test.rkt index 0d6b4e2ae7..69ee78b1f2 100644 --- a/collects/rackunit/private/test.rkt +++ b/collects/rackunit/private/test.rkt @@ -75,7 +75,7 @@ test-exn test-not-exn - foldts + foldts-test-suite fold-test-results run-test-case run-test diff --git a/collects/rackunit/scribblings/internals.scrbl b/collects/rackunit/scribblings/internals.scrbl index 0e58bcd25b..586ceb7d8f 100644 --- a/collects/rackunit/scribblings/internals.scrbl +++ b/collects/rackunit/scribblings/internals.scrbl @@ -155,7 +155,7 @@ test results without you having to take care of all the expected setup and teardown. For example, @racket[fold-test-results] will run test suite before and after actions for you. However it is still flexible enough, via its keyword arguments, to do almost anything that -@racket[foldts] can. Hence it should be used in preference to @racket[foldts]. +@racket[foldts-test-suite] can. Hence it should be used in preference to @racket[foldts-test-suite]. The @racket[result-fn] argument is a function from the results of @racket[run] (defaults to a @racket[test-result]) and the seed to a @@ -203,14 +203,14 @@ value of @racket[run]. #:run (lambda (name action) 'burp)))] -@defproc[(foldts [fdown (test-suite string thunk thunk 'a -> 'a)] +@defproc[(foldts-test-suite [fdown (test-suite string thunk thunk 'a -> 'a)] [fup (test-suite string thunk thunk 'a 'a -> 'a)] [fhere(test-case string thunk 'a -> 'a)] [seed 'a] [test (or/c test-case? test-suite?)]) 'a]{ -The @racket[foldts] function is a nifty tree fold (created by Oleg +The @racket[foldts-test-suite] function is a nifty tree fold (created by Oleg Kiselyov) that folds over a test in a useful way (@racket[fold-test-results] isn't that useful as you can't specify actions around test cases). @@ -234,11 +234,11 @@ turn would allow test cases that are, for example, ignored). Example: Here's the implementation of @racket[fold-test-results] in terms of -@racket[foldts]: +@racket[foldts-test-suite]: @racketblock[ (define (fold-test-results suite-fn case-fn seed test) - (foldts + (foldts-test-suite (lambda (suite name before after seed) (before) (suite-fn name seed)) @@ -254,7 +254,7 @@ Here's the implementation of @racket[fold-test-results] in terms of ] If you're used to folds you'll probably be a bit surprised that the -functions you pass to @racket[foldts] receive both the structure they +functions you pass to @racket[foldts-test-suite] receive both the structure they operate on, and the contents of that structure. This is indeed unusual. It is done to allow subtypes of test-case and test-suite to be run in customised ways. For example, you might define subtypes of