Skip to content

Commit

Permalink
Move meta checks to separate module
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfirth committed Sep 2, 2017
1 parent 32acc1d commit 4c85b39
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
5 changes: 4 additions & 1 deletion rackunit-doc/rackunit/scribblings/check.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@(require (for-label racket/match))

@(define rackunit-eval (make-base-eval))
@(interaction-eval #:eval rackunit-eval (require rackunit))
@(interaction-eval #:eval rackunit-eval (require rackunit rackunit/meta))
@(interaction-eval #:eval rackunit-eval (error-print-context-length 0))

@title{Checks}
Expand Down Expand Up @@ -458,12 +458,15 @@ The optional message is used as the exception's
message.}

@section{Testing Custom Checks}
@defmodule[rackunit/meta]

Custom checks such as those created by @racket[define-check] can contain a fair
amount of logic. Consequently, custom checks can be buggy and should be tested.
RackUnit provides a handful of checks explicitly designed for testing the
behavior of other checks; they allow verifying checks pass and fail when
expected or that checks add certain information to the check information stack.
These bindings are provided by @racketmodname[rackunit/meta], not
@racketmodname[rackunit].

@defproc[(check-fail [fail-exn-predicate
(or/c (-> exn:test:check? any/c) regexp?)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
racket/list
rackunit/log
syntax/parse/define
"base.rkt"
"check.rkt"
"check-info.rkt")
rackunit
rackunit/private/check-info)


(define-check (check-fail pred-or-msg chk-thnk)
Expand Down
8 changes: 3 additions & 5 deletions rackunit-lib/rackunit/private/test.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
"base.rkt"
"check.rkt"
"check-info.rkt"
"meta.rkt"
"result.rkt"
"test-case.rkt"
"test-suite.rkt"
"util.rkt")

(provide (all-from-out "meta.rkt")
(struct-out exn:test)
(provide (struct-out exn:test)
(struct-out exn:test:check)
(struct-out check-info)
(struct-out test-result)
Expand Down Expand Up @@ -57,7 +55,7 @@
current-test-case-around
test-suite-test-case-around
test-suite-check-around

define-test-suite
define/provide-test-suite
test-suite*
Expand Down Expand Up @@ -93,7 +91,7 @@
define-check
define-simple-check
define-binary-check

current-check-handler
current-check-around

Expand Down
3 changes: 2 additions & 1 deletion rackunit-test/tests/rackunit/meta-test.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#lang racket/base

(module+ test
(require rackunit)
(require rackunit
rackunit/meta)

(define foo-info (make-check-info 'foo 'foo))
(define-check (check-raise) (raise 'foo))
Expand Down

0 comments on commit 4c85b39

Please sign in to comment.