renamed foldts to foldts-test-suite

This commit is contained in:
John Clements 2011-03-07 22:45:27 -08:00
parent a1b79387b9
commit 683f6b0fe4
4 changed files with 13 additions and 13 deletions

View File

@ -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:
#|

View File

@ -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)

View File

@ -75,7 +75,7 @@
test-exn
test-not-exn
foldts
foldts-test-suite
fold-test-results
run-test-case
run-test

View File

@ -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