From 4c85b39568147374f09db14dcb30fc77da21ec68 Mon Sep 17 00:00:00 2001 From: Jack Firth Date: Mon, 14 Aug 2017 21:56:42 -0700 Subject: [PATCH] Move meta checks to separate module --- rackunit-doc/rackunit/scribblings/check.scrbl | 5 ++++- rackunit-lib/rackunit/{private => }/meta.rkt | 5 ++--- rackunit-lib/rackunit/private/test.rkt | 8 +++----- rackunit-test/tests/rackunit/meta-test.rkt | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-) rename rackunit-lib/rackunit/{private => }/meta.rkt (98%) diff --git a/rackunit-doc/rackunit/scribblings/check.scrbl b/rackunit-doc/rackunit/scribblings/check.scrbl index ff54f09..5add46d 100644 --- a/rackunit-doc/rackunit/scribblings/check.scrbl +++ b/rackunit-doc/rackunit/scribblings/check.scrbl @@ -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} @@ -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?)] diff --git a/rackunit-lib/rackunit/private/meta.rkt b/rackunit-lib/rackunit/meta.rkt similarity index 98% rename from rackunit-lib/rackunit/private/meta.rkt rename to rackunit-lib/rackunit/meta.rkt index 5c1de91..b4cea14 100644 --- a/rackunit-lib/rackunit/private/meta.rkt +++ b/rackunit-lib/rackunit/meta.rkt @@ -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) diff --git a/rackunit-lib/rackunit/private/test.rkt b/rackunit-lib/rackunit/private/test.rkt index 5fb685b..4650500 100644 --- a/rackunit-lib/rackunit/private/test.rkt +++ b/rackunit-lib/rackunit/private/test.rkt @@ -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) @@ -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* @@ -93,7 +91,7 @@ define-check define-simple-check define-binary-check - + current-check-handler current-check-around diff --git a/rackunit-test/tests/rackunit/meta-test.rkt b/rackunit-test/tests/rackunit/meta-test.rkt index eb0e6f3..77db7d9 100644 --- a/rackunit-test/tests/rackunit/meta-test.rkt +++ b/rackunit-test/tests/rackunit/meta-test.rkt @@ -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))