Renaming rktunit to racunit
original commit: bc5cf30ebe1ba3743f7097d81ebf1297435e0201
This commit is contained in:
commit
7e3a6cd862
|
@ -6,7 +6,7 @@
|
||||||
(define (test/gui . tests)
|
(define (test/gui . tests)
|
||||||
(apply (make-gui-runner) tests))
|
(apply (make-gui-runner) tests))
|
||||||
|
|
||||||
(define test/c (or/c rktunit-test-case? rktunit-test-suite?))
|
(define test/c (or/c racunit-test-case? racunit-test-suite?))
|
||||||
|
|
||||||
(provide/contract
|
(provide/contract
|
||||||
[test/gui
|
[test/gui
|
|
@ -4,10 +4,10 @@
|
||||||
|
|
||||||
;; struct test :
|
;; struct test :
|
||||||
(define-struct test ())
|
(define-struct test ())
|
||||||
;; struct (rktunit-test-case test) : (U string #f) thunk
|
;; struct (racunit-test-case test) : (U string #f) thunk
|
||||||
(define-struct (rktunit-test-case test) (name action) #:transparent)
|
(define-struct (racunit-test-case test) (name action) #:transparent)
|
||||||
;; struct (rktunit-test-suite test) : string (fdown fup fhere seed -> (listof test-result)) thunk thunk
|
;; struct (racunit-test-suite test) : string (fdown fup fhere seed -> (listof test-result)) thunk thunk
|
||||||
(define-struct (rktunit-test-suite test) (name tests before after) #:transparent)
|
(define-struct (racunit-test-suite test) (name tests before after) #:transparent)
|
||||||
|
|
||||||
;; struct exn:test exn : ()
|
;; struct exn:test exn : ()
|
||||||
;;
|
;;
|
||||||
|
@ -33,10 +33,10 @@
|
||||||
(define-struct (test-success test-result) (result))
|
(define-struct (test-success test-result) (result))
|
||||||
|
|
||||||
(provide/contract
|
(provide/contract
|
||||||
(struct (rktunit-test-case test)
|
(struct (racunit-test-case test)
|
||||||
((name (or/c string? false/c))
|
((name (or/c string? false/c))
|
||||||
(action (-> any))))
|
(action (-> any))))
|
||||||
(struct (rktunit-test-suite test)
|
(struct (racunit-test-suite test)
|
||||||
((name string?)
|
((name string?)
|
||||||
(tests procedure?)
|
(tests procedure?)
|
||||||
(before (-> any))
|
(before (-> any))
|
|
@ -11,7 +11,7 @@
|
||||||
;; Infrastructure ----------------------------------------------
|
;; Infrastructure ----------------------------------------------
|
||||||
|
|
||||||
;; The continuation mark under which all check-info is keyed
|
;; The continuation mark under which all check-info is keyed
|
||||||
(define check-info-mark (gensym 'rktunit))
|
(define check-info-mark (gensym 'racunit))
|
||||||
|
|
||||||
;; (continuation-mark-set -> (listof check-info))
|
;; (continuation-mark-set -> (listof check-info))
|
||||||
(define (check-info-stack marks)
|
(define (check-info-stack marks)
|
|
@ -5,20 +5,20 @@
|
||||||
|
|
||||||
;; Frame size preferences
|
;; Frame size preferences
|
||||||
|
|
||||||
(preferences:set-default 'rktunit:frame:width 400 exact-positive-integer?)
|
(preferences:set-default 'racunit:frame:width 400 exact-positive-integer?)
|
||||||
(preferences:set-default 'rktunit:frame:height 400 exact-positive-integer?)
|
(preferences:set-default 'racunit:frame:height 400 exact-positive-integer?)
|
||||||
(define pref:width (pref:get/set 'rktunit:frame:width))
|
(define pref:width (pref:get/set 'racunit:frame:width))
|
||||||
(define pref:height (pref:get/set 'rktunit:frame:height))
|
(define pref:height (pref:get/set 'racunit:frame:height))
|
||||||
|
|
||||||
;; CONSTANTS
|
;; CONSTANTS
|
||||||
;; Some of these are obsolete, given the preferences above.
|
;; Some of these are obsolete, given the preferences above.
|
||||||
|
|
||||||
(define DETAILS-CANVAS-INIT-WIDTH 400)
|
(define DETAILS-CANVAS-INIT-WIDTH 400)
|
||||||
(define FRAME-LABEL "RktUnit")
|
(define FRAME-LABEL "RacUnit")
|
||||||
(define FRAME-INIT-HEIGHT 400)
|
(define FRAME-INIT-HEIGHT 400)
|
||||||
(define TREE-INIT-WIDTH 240)
|
(define TREE-INIT-WIDTH 240)
|
||||||
(define TREE-COLORIZE-CASES #t)
|
(define TREE-COLORIZE-CASES #t)
|
||||||
(define DIALOG-ERROR-TITLE "RktUnit: Error")
|
(define DIALOG-ERROR-TITLE "RacUnit: Error")
|
||||||
(define STATUS-SUCCESS 'success)
|
(define STATUS-SUCCESS 'success)
|
||||||
(define STATUS-FAILURE 'failure)
|
(define STATUS-FAILURE 'failure)
|
||||||
(define STATUS-ERROR 'error)
|
(define STATUS-ERROR 'error)
|
|
@ -25,18 +25,18 @@
|
||||||
;; create-model : test suite<%>/#f -> result<%>
|
;; create-model : test suite<%>/#f -> result<%>
|
||||||
(define/public (create-model test parent)
|
(define/public (create-model test parent)
|
||||||
(define result
|
(define result
|
||||||
(cond [(rktunit-test-case? test)
|
(cond [(racunit-test-case? test)
|
||||||
(new case-result%
|
(new case-result%
|
||||||
(controller this)
|
(controller this)
|
||||||
(test test)
|
(test test)
|
||||||
(name (or (rktunit-test-case-name test)
|
(name (or (racunit-test-case-name test)
|
||||||
"<unnamed test-case>"))
|
"<unnamed test-case>"))
|
||||||
(parent parent))]
|
(parent parent))]
|
||||||
[(rktunit-test-suite? test)
|
[(racunit-test-suite? test)
|
||||||
(new suite-result%
|
(new suite-result%
|
||||||
(controller this)
|
(controller this)
|
||||||
(test test)
|
(test test)
|
||||||
(name (or (rktunit-test-suite-name test)
|
(name (or (racunit-test-suite-name test)
|
||||||
"<unnamed test-suite>"))
|
"<unnamed test-suite>"))
|
||||||
(parent parent))]))
|
(parent parent))]))
|
||||||
(send/i view view<%> create-view-link result parent)
|
(send/i view view<%> create-view-link result parent)
|
|
@ -48,8 +48,8 @@
|
||||||
#|
|
#|
|
||||||
(define/public (run)
|
(define/public (run)
|
||||||
(let ([custodian (make-custodian)]
|
(let ([custodian (make-custodian)]
|
||||||
[before (rktunit-test-suite-before test)]
|
[before (racunit-test-suite-before test)]
|
||||||
[after (rktunit-test-suite-after test)])
|
[after (racunit-test-suite-after test)])
|
||||||
(parameterize [(current-custodian custodian)]
|
(parameterize [(current-custodian custodian)]
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
before
|
before
|
||||||
|
@ -112,8 +112,8 @@
|
||||||
(call-with-continuation-prompt
|
(call-with-continuation-prompt
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(time-apply run-test-case
|
(time-apply run-test-case
|
||||||
(list (rktunit-test-case-name test)
|
(list (racunit-test-case-name test)
|
||||||
(rktunit-test-case-action test)))))])
|
(racunit-test-case-action test)))))])
|
||||||
(values (car results) (list cputime realtime gctime))))
|
(values (car results) (list cputime realtime gctime))))
|
||||||
|
|
||||||
(define (make-output-ports)
|
(define (make-output-ports)
|
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 513 B |
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
(provide insert-text
|
(provide insert-text
|
||||||
ext:text%
|
ext:text%
|
||||||
rktunit-style-map)
|
racunit-style-map)
|
||||||
|
|
||||||
;; insert-text : text% string style-delta% -> void
|
;; insert-text : text% string style-delta% -> void
|
||||||
(define (insert-text e text style)
|
(define (insert-text e text style)
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
(define ext:text-mixin
|
(define ext:text-mixin
|
||||||
(mixin (text<%>) ()
|
(mixin (text<%>) ()
|
||||||
(init-field (style-map rktunit-style-map))
|
(init-field (style-map racunit-style-map))
|
||||||
(inherit last-position
|
(inherit last-position
|
||||||
change-style
|
change-style
|
||||||
set-clickback
|
set-clickback
|
||||||
|
@ -139,7 +139,7 @@
|
||||||
[error . ,style:red]
|
[error . ,style:red]
|
||||||
[value . ,style:darkblue]))
|
[value . ,style:darkblue]))
|
||||||
|
|
||||||
(define rktunit-styles
|
(define racunit-styles
|
||||||
`([test-unexecuted . ,style:gray]
|
`([test-unexecuted . ,style:gray]
|
||||||
[test-success . ,style:green]
|
[test-success . ,style:green]
|
||||||
[test-failure . ,style:red]
|
[test-failure . ,style:red]
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
(extend-style-map empty-style-map
|
(extend-style-map empty-style-map
|
||||||
basic-styles))
|
basic-styles))
|
||||||
|
|
||||||
;; rktunit-style-map : style-map<%>
|
;; racunit-style-map : style-map<%>
|
||||||
(define rktunit-style-map
|
(define racunit-style-map
|
||||||
(extend-style-map basic-style-map
|
(extend-style-map basic-style-map
|
||||||
rktunit-styles))
|
racunit-styles))
|
|
@ -13,7 +13,7 @@
|
||||||
(provide make-view-frame
|
(provide make-view-frame
|
||||||
view%)
|
view%)
|
||||||
|
|
||||||
(define style-map rktunit-style-map)
|
(define style-map racunit-style-map)
|
||||||
|
|
||||||
#|
|
#|
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ still be there, just not visible?
|
||||||
controller)
|
controller)
|
||||||
(super-new)
|
(super-new)
|
||||||
|
|
||||||
(define editor (new ext:text% (style-map rktunit-style-map)))
|
(define editor (new ext:text% (style-map racunit-style-map)))
|
||||||
(define renderer
|
(define renderer
|
||||||
(new model-renderer%
|
(new model-renderer%
|
||||||
(controller controller)
|
(controller controller)
|
||||||
|
@ -146,7 +146,7 @@ still be there, just not visible?
|
||||||
;; If the view-link has not been created,
|
;; If the view-link has not been created,
|
||||||
;; yield until it is.
|
;; yield until it is.
|
||||||
(unless (yield)
|
(unless (yield)
|
||||||
(error 'rktunit-gui
|
(error 'racunit-gui
|
||||||
"internal error: no progress waiting for view-link"))
|
"internal error: no progress waiting for view-link"))
|
||||||
(do-model-update model)])))
|
(do-model-update model)])))
|
||||||
|
|
|
@ -51,12 +51,12 @@
|
||||||
;; data so FP is a bit ugly].
|
;; data so FP is a bit ugly].
|
||||||
(define (foldts fdown fup fhere seed test)
|
(define (foldts fdown fup fhere seed test)
|
||||||
(cond
|
(cond
|
||||||
((rktunit-test-case? test)
|
((racunit-test-case? test)
|
||||||
(fhere test
|
(fhere test
|
||||||
(rktunit-test-case-name test)
|
(racunit-test-case-name test)
|
||||||
(rktunit-test-case-action test)
|
(racunit-test-case-action test)
|
||||||
seed))
|
seed))
|
||||||
((rktunit-test-suite? test)
|
((racunit-test-suite? test)
|
||||||
(apply-test-suite test fdown fup fhere seed))
|
(apply-test-suite test fdown fup fhere seed))
|
||||||
(else
|
(else
|
||||||
(raise
|
(raise
|
|
@ -27,14 +27,14 @@
|
||||||
(define (test-suite-test-case-around fhere)
|
(define (test-suite-test-case-around fhere)
|
||||||
(lambda (thunk)
|
(lambda (thunk)
|
||||||
(let* ([name (current-test-name)]
|
(let* ([name (current-test-name)]
|
||||||
[test (make-rktunit-test-case name thunk)]
|
[test (make-racunit-test-case name thunk)]
|
||||||
[seed (current-seed)])
|
[seed (current-seed)])
|
||||||
(current-seed (fhere test name thunk seed)))))
|
(current-seed (fhere test name thunk seed)))))
|
||||||
|
|
||||||
(define (test-suite-check-around fhere)
|
(define (test-suite-check-around fhere)
|
||||||
(lambda (thunk)
|
(lambda (thunk)
|
||||||
(let* ([name #f]
|
(let* ([name #f]
|
||||||
[test (make-rktunit-test-case name thunk)]
|
[test (make-racunit-test-case name thunk)]
|
||||||
[seed (current-seed)])
|
[seed (current-seed)])
|
||||||
(current-seed (fhere test name thunk seed)))))
|
(current-seed (fhere test name thunk seed)))))
|
||||||
|
|
||||||
|
@ -42,12 +42,12 @@
|
||||||
(define delayed-test-case-around
|
(define delayed-test-case-around
|
||||||
(lambda (thunk)
|
(lambda (thunk)
|
||||||
(let ([name (current-test-name)])
|
(let ([name (current-test-name)])
|
||||||
(make-rktunit-test-case name thunk))))
|
(make-racunit-test-case name thunk))))
|
||||||
|
|
||||||
(define delayed-check-around
|
(define delayed-check-around
|
||||||
(lambda (thunk)
|
(lambda (thunk)
|
||||||
(let ([name #f])
|
(let ([name #f])
|
||||||
(make-rktunit-test-case name thunk))))
|
(make-racunit-test-case name thunk))))
|
||||||
|
|
||||||
(define-syntax delay-test
|
(define-syntax delay-test
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
|
@ -58,12 +58,12 @@
|
||||||
test test1 ...)]))
|
test test1 ...)]))
|
||||||
|
|
||||||
(define (apply-test-suite suite fdown fup fhere seed)
|
(define (apply-test-suite suite fdown fup fhere seed)
|
||||||
(let* ([name (rktunit-test-suite-name suite)]
|
(let* ([name (racunit-test-suite-name suite)]
|
||||||
[tests (rktunit-test-suite-tests suite)]
|
[tests (racunit-test-suite-tests suite)]
|
||||||
[before (rktunit-test-suite-before suite)]
|
[before (racunit-test-suite-before suite)]
|
||||||
[after (rktunit-test-suite-after suite)]
|
[after (racunit-test-suite-after suite)]
|
||||||
[kid-seed (fdown suite name before after seed)]
|
[kid-seed (fdown suite name before after seed)]
|
||||||
[kid-seed ((rktunit-test-suite-tests suite) fdown fup fhere kid-seed)])
|
[kid-seed ((racunit-test-suite-tests suite) fdown fup fhere kid-seed)])
|
||||||
(fup suite name before after seed kid-seed)))
|
(fup suite name before after seed kid-seed)))
|
||||||
|
|
||||||
;; test-suite : name [#:before thunk] [#:after thunk] test ...
|
;; test-suite : name [#:before thunk] [#:after thunk] test ...
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
[the-tests
|
[the-tests
|
||||||
(lambda (fdown fup fhere seed)
|
(lambda (fdown fup fhere seed)
|
||||||
(define (run/inner x)
|
(define (run/inner x)
|
||||||
(cond [(rktunit-test-suite? x)
|
(cond [(racunit-test-suite? x)
|
||||||
(current-seed
|
(current-seed
|
||||||
(apply-test-suite x fdown fup fhere (current-seed)))]
|
(apply-test-suite x fdown fup fhere (current-seed)))]
|
||||||
[(list? x)
|
[(list? x)
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
[(not (string? the-name))
|
[(not (string? the-name))
|
||||||
(raise-type-error 'test-suite "test-suite name as string" the-name)]
|
(raise-type-error 'test-suite "test-suite name as string" the-name)]
|
||||||
[else
|
[else
|
||||||
(make-rktunit-test-suite
|
(make-racunit-test-suite
|
||||||
the-name
|
the-name
|
||||||
the-tests
|
the-tests
|
||||||
before-thunk
|
before-thunk
|
||||||
|
@ -138,13 +138,13 @@
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (t)
|
(lambda (t)
|
||||||
(cond
|
(cond
|
||||||
[(rktunit-test-suite? t)
|
[(racunit-test-suite? t)
|
||||||
(current-seed (apply-test-suite t fdown fup fhere (current-seed)))]
|
(current-seed (apply-test-suite t fdown fup fhere (current-seed)))]
|
||||||
[(rktunit-test-case? t)
|
[(racunit-test-case? t)
|
||||||
(current-seed
|
(current-seed
|
||||||
(fhere t
|
(fhere t
|
||||||
(rktunit-test-case-name t)
|
(racunit-test-case-name t)
|
||||||
(rktunit-test-case-action t)
|
(racunit-test-case-action t)
|
||||||
(current-seed)))]
|
(current-seed)))]
|
||||||
[else
|
[else
|
||||||
(raise
|
(raise
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
;;
|
;;
|
||||||
;; Construct a test suite from a list of tests
|
;; Construct a test suite from a list of tests
|
||||||
(define (make-test-suite name #:before [before void-thunk] #:after [after void-thunk] tests)
|
(define (make-test-suite name #:before [before void-thunk] #:after [after void-thunk] tests)
|
||||||
(make-rktunit-test-suite name
|
(make-racunit-test-suite name
|
||||||
(tests->test-suite-action tests)
|
(tests->test-suite-action tests)
|
||||||
before
|
before
|
||||||
after))
|
after))
|
|
@ -15,8 +15,8 @@
|
||||||
(struct-out test-failure)
|
(struct-out test-failure)
|
||||||
(struct-out test-error)
|
(struct-out test-error)
|
||||||
(struct-out test-success)
|
(struct-out test-success)
|
||||||
(struct-out rktunit-test-case)
|
(struct-out racunit-test-case)
|
||||||
(struct-out rktunit-test-suite)
|
(struct-out racunit-test-suite)
|
||||||
|
|
||||||
with-check-info
|
with-check-info
|
||||||
with-check-info*
|
with-check-info*
|
||||||
|
@ -42,9 +42,9 @@
|
||||||
test-suite
|
test-suite
|
||||||
make-test-suite
|
make-test-suite
|
||||||
delay-test
|
delay-test
|
||||||
(rename-out [make-rktunit-test-case make-test-case]
|
(rename-out [make-racunit-test-case make-test-case]
|
||||||
[rktunit-test-case? test-case?]
|
[racunit-test-case? test-case?]
|
||||||
[rktunit-test-suite? test-suite?])
|
[racunit-test-suite? test-suite?])
|
||||||
|
|
||||||
define-test-suite
|
define-test-suite
|
||||||
define/provide-test-suite
|
define/provide-test-suite
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
@title{Acknowlegements}
|
@title{Acknowlegements}
|
||||||
|
|
||||||
The following people have contributed to RktUnit:
|
The following people have contributed to RacUnit:
|
||||||
|
|
||||||
@itemize[
|
@itemize[
|
||||||
@item{Robby Findler pushed me to release version 3}
|
@item{Robby Findler pushed me to release version 3}
|
||||||
|
@ -12,7 +12,7 @@ The following people have contributed to RktUnit:
|
||||||
suggested renaming @racket[test/text-ui]}
|
suggested renaming @racket[test/text-ui]}
|
||||||
|
|
||||||
@item{Dave Gurnell reported a bug in check-not-exn and
|
@item{Dave Gurnell reported a bug in check-not-exn and
|
||||||
suggested improvements to RktUnit}
|
suggested improvements to RacUnit}
|
||||||
|
|
||||||
@item{Danny Yoo reported a bug in and provided a fix for
|
@item{Danny Yoo reported a bug in and provided a fix for
|
||||||
trim-current-directory}
|
trim-current-directory}
|
||||||
|
@ -30,7 +30,7 @@ The following people have contributed to RktUnit:
|
||||||
@item{Jose A. Ortega Ruiz alerted me a problem in the
|
@item{Jose A. Ortega Ruiz alerted me a problem in the
|
||||||
packaging system and helped fix it.}
|
packaging system and helped fix it.}
|
||||||
|
|
||||||
@item{Sebastian H. Seidel provided help packaging RktUnit
|
@item{Sebastian H. Seidel provided help packaging RacUnit
|
||||||
into a .plt}
|
into a .plt}
|
||||||
|
|
||||||
@item{Don Blaheta provided the method for grabbing line number
|
@item{Don Blaheta provided the method for grabbing line number
|
|
@ -1,10 +1,10 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "base.rkt")
|
@(require "base.rkt")
|
||||||
|
|
||||||
@title[#:tag "api"]{RktUnit API}
|
@title[#:tag "api"]{RacUnit API}
|
||||||
|
|
||||||
@defmodule[rktunit
|
@defmodule[racunit
|
||||||
#:use-sources (rktunit)]
|
#:use-sources (racunit)]
|
||||||
|
|
||||||
@include-section["overview.scrbl"]
|
@include-section["overview.scrbl"]
|
||||||
@include-section["check.scrbl"]
|
@include-section["check.scrbl"]
|
|
@ -6,15 +6,15 @@
|
||||||
|
|
||||||
(for-label scheme/base
|
(for-label scheme/base
|
||||||
scheme/contract
|
scheme/contract
|
||||||
rktunit
|
racunit
|
||||||
rktunit/text-ui
|
racunit/text-ui
|
||||||
rktunit/gui))
|
racunit/gui))
|
||||||
|
|
||||||
(provide
|
(provide
|
||||||
(all-from-out scribble/eval
|
(all-from-out scribble/eval
|
||||||
scribble/manual)
|
scribble/manual)
|
||||||
(for-label (all-from-out scheme/base
|
(for-label (all-from-out scheme/base
|
||||||
scheme/contract
|
scheme/contract
|
||||||
rktunit
|
racunit
|
||||||
rktunit/text-ui
|
racunit/text-ui
|
||||||
rktunit/gui)))
|
racunit/gui)))
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
@title{Checks}
|
@title{Checks}
|
||||||
|
|
||||||
Checks are the basic building block of RktUnit. A check
|
Checks are the basic building block of RacUnit. A check
|
||||||
checks some condition. If the condition holds the check
|
checks some condition. If the condition holds the check
|
||||||
evaluates to @racket[#t]. If the condition doesn't hold the
|
evaluates to @racket[#t]. If the condition doesn't hold the
|
||||||
check raises an instance of @racket[exn:test:check] with
|
check raises an instance of @racket[exn:test:check] with
|
||||||
|
@ -16,7 +16,7 @@ their arguments. You can use check as first class
|
||||||
functions, though you will lose precision in the reported
|
functions, though you will lose precision in the reported
|
||||||
source locations if you do so.
|
source locations if you do so.
|
||||||
|
|
||||||
The following are the basic checks RktUnit provides. You
|
The following are the basic checks RacUnit provides. You
|
||||||
can create your own checks using @racket[define-check].
|
can create your own checks using @racket[define-check].
|
||||||
|
|
||||||
@defproc[(check (op (-> any any any))
|
@defproc[(check (op (-> any any any))
|
|
@ -147,7 +147,7 @@ creates test cases within the suite, with the given names and
|
||||||
body expressions.
|
body expressions.
|
||||||
|
|
||||||
As far I know no-one uses this macro, so it might disappear
|
As far I know no-one uses this macro, so it might disappear
|
||||||
in future versions of RktUnit.}
|
in future versions of RacUnit.}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,5 +48,5 @@ file. The after action deletes it.
|
||||||
This somewhat curious macro evaluates the given tests in a
|
This somewhat curious macro evaluates the given tests in a
|
||||||
context where @racket[current-test-case-around] is
|
context where @racket[current-test-case-around] is
|
||||||
parameterized to @racket[test-suite-test-case-around]. This
|
parameterized to @racket[test-suite-test-case-around]. This
|
||||||
has been useful in testing RktUnit. It might be useful
|
has been useful in testing RacUnit. It might be useful
|
||||||
for you if you create test cases that create test cases.}
|
for you if you create test cases that create test cases.}
|
|
@ -1,6 +1,6 @@
|
||||||
#lang scheme/base
|
#lang scheme/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
"file.rkt")
|
"file.rkt")
|
||||||
|
|
||||||
(check-equal? (my-+ 1 1) 2)
|
(check-equal? (my-+ 1 1) 2)
|
|
@ -14,8 +14,8 @@ Note that @racket[require/expose] can be a bit fragile,
|
||||||
especially when mixed with compiled code. Use at your own risk!
|
especially when mixed with compiled code. Use at your own risk!
|
||||||
}
|
}
|
||||||
|
|
||||||
This example gets @racket[make-failure-test], which is defined in a RktUnit test:
|
This example gets @racket[make-failure-test], which is defined in a RacUnit test:
|
||||||
|
|
||||||
@racketblock[
|
@racketblock[
|
||||||
(require/expose rktunit/private/check-test (make-failure-test))
|
(require/expose racunit/private/check-test (make-failure-test))
|
||||||
]
|
]
|
|
@ -1,9 +1,9 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "base.rkt")
|
@(require "base.rkt")
|
||||||
|
|
||||||
@title{Overview of RktUnit}
|
@title{Overview of RacUnit}
|
||||||
|
|
||||||
There are three basic data types in RktUnit:
|
There are three basic data types in RacUnit:
|
||||||
|
|
||||||
@itemize[
|
@itemize[
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "base.rkt")
|
@(require "base.rkt")
|
||||||
|
|
||||||
@title[#:tag "philosophy"]{The Philosophy of RktUnit}
|
@title[#:tag "philosophy"]{The Philosophy of RacUnit}
|
||||||
|
|
||||||
RktUnit is designed to allow tests to evolve in step with
|
RacUnit is designed to allow tests to evolve in step with
|
||||||
the evolution of the program under testing. RktUnit
|
the evolution of the program under testing. RacUnit
|
||||||
scales from the unstructed checks suitable for simple
|
scales from the unstructed checks suitable for simple
|
||||||
programs to the complex structure necessary for large
|
programs to the complex structure necessary for large
|
||||||
projects.
|
projects.
|
||||||
|
@ -25,9 +25,9 @@ checking are of the form:
|
||||||
(equal? (length '(a b)) 2)
|
(equal? (length '(a b)) 2)
|
||||||
]
|
]
|
||||||
|
|
||||||
RktUnit directly supports this style of testing. A check
|
RacUnit directly supports this style of testing. A check
|
||||||
on its own is a valid test. So the above examples may be
|
on its own is a valid test. So the above examples may be
|
||||||
written in RktUnit as:
|
written in RacUnit as:
|
||||||
|
|
||||||
@racketblock[
|
@racketblock[
|
||||||
(check-equal? (length null) 0)
|
(check-equal? (length null) 0)
|
||||||
|
@ -35,7 +35,7 @@ written in RktUnit as:
|
||||||
(check-equal? (length '(a b)) 2)
|
(check-equal? (length '(a b)) 2)
|
||||||
]
|
]
|
||||||
|
|
||||||
Simple programs now get all the benefits of RktUnit with
|
Simple programs now get all the benefits of RacUnit with
|
||||||
very little overhead.
|
very little overhead.
|
||||||
|
|
||||||
There are limitations to this style of testing that more
|
There are limitations to this style of testing that more
|
||||||
|
@ -45,7 +45,7 @@ it does not make sense to evaluate some expressions if
|
||||||
earlier ones have failed. This type of program needs a way
|
earlier ones have failed. This type of program needs a way
|
||||||
to group expressions so that a failure in one group causes
|
to group expressions so that a failure in one group causes
|
||||||
evaluation of that group to stop and immediately proceed to
|
evaluation of that group to stop and immediately proceed to
|
||||||
the next group. In RktUnit all that is required is to
|
the next group. In RacUnit all that is required is to
|
||||||
wrap a @racket[test-begin] expression around a group of
|
wrap a @racket[test-begin] expression around a group of
|
||||||
expressions:
|
expressions:
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ be evaluated.
|
||||||
|
|
||||||
Notice that all the previous tests written in the simple
|
Notice that all the previous tests written in the simple
|
||||||
style are still valid. Introducing grouping is a local
|
style are still valid. Introducing grouping is a local
|
||||||
change only. This is a key feature of RktUnit's support
|
change only. This is a key feature of RacUnit's support
|
||||||
for the evolution of the program.
|
for the evolution of the program.
|
||||||
|
|
||||||
The programmer may wish to name a group of tests. This is
|
The programmer may wish to name a group of tests. This is
|
||||||
|
@ -79,7 +79,7 @@ Most programs will stick with this style. However,
|
||||||
programmers writing very complex programs may wish to
|
programmers writing very complex programs may wish to
|
||||||
maintain separate groups of tests for different parts of the
|
maintain separate groups of tests for different parts of the
|
||||||
program, or run their tests in different ways to the normal
|
program, or run their tests in different ways to the normal
|
||||||
RktUnit manner (for example, test results may be logged
|
RacUnit manner (for example, test results may be logged
|
||||||
for the purpose of improving software quality, or they may
|
for the purpose of improving software quality, or they may
|
||||||
be displayed on a website to indicate service quality). For
|
be displayed on a website to indicate service quality). For
|
||||||
these programmers it is necessary to delay the execution of
|
these programmers it is necessary to delay the execution of
|
||||||
|
@ -104,15 +104,15 @@ outside the suite continue to evaluate as before.
|
||||||
@section{Historical Context}
|
@section{Historical Context}
|
||||||
|
|
||||||
Most testing frameworks, including earlier versions of
|
Most testing frameworks, including earlier versions of
|
||||||
RktUnit, support only the final form of testing. This is
|
RacUnit, support only the final form of testing. This is
|
||||||
likely due to the influence of the SUnit testing framework,
|
likely due to the influence of the SUnit testing framework,
|
||||||
which is the ancestor of RktUnit and the most widely used
|
which is the ancestor of RacUnit and the most widely used
|
||||||
frameworks in Java, .Net, Python, and Ruby, and many other
|
frameworks in Java, .Net, Python, and Ruby, and many other
|
||||||
languages. That this is insufficient for all users is
|
languages. That this is insufficient for all users is
|
||||||
apparent if one considers the proliferation of ``simpler''
|
apparent if one considers the proliferation of ``simpler''
|
||||||
testing frameworks in Racket such as SRFI-78, or the
|
testing frameworks in Racket such as SRFI-78, or the
|
||||||
practice of beginner programmers. Unfortunately these
|
practice of beginner programmers. Unfortunately these
|
||||||
simpler methods are inadequate for testing larger
|
simpler methods are inadequate for testing larger
|
||||||
systems. To the best of my knowledge RktUnit is the only
|
systems. To the best of my knowledge RacUnit is the only
|
||||||
testing framework that makes a conscious effort to support
|
testing framework that makes a conscious effort to support
|
||||||
the testing style of all levels of programmer.
|
the testing style of all levels of programmer.
|
|
@ -1,7 +1,7 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "base.rkt")
|
@(require "base.rkt")
|
||||||
|
|
||||||
@title[#:tag "quick-start"]{Quick Start Guide for RktUnit}
|
@title[#:tag "quick-start"]{Quick Start Guide for RacUnit}
|
||||||
|
|
||||||
Suppose we have code contained in @tt{file.rkt}, which
|
Suppose we have code contained in @tt{file.rkt}, which
|
||||||
implements buggy versions of @racket[+] and @racket[-]
|
implements buggy versions of @racket[+] and @racket[-]
|
||||||
|
@ -24,15 +24,15 @@ racket/base
|
||||||
my-*)
|
my-*)
|
||||||
]
|
]
|
||||||
|
|
||||||
We want to test this code with RktUnit. We start by
|
We want to test this code with RacUnit. We start by
|
||||||
creating a file called @tt{file-test.rkt} to contain our
|
creating a file called @tt{file-test.rkt} to contain our
|
||||||
tests. At the top of @tt{file-test.rkt} we import
|
tests. At the top of @tt{file-test.rkt} we import
|
||||||
RktUnit and @tt{file.rkt}:
|
RacUnit and @tt{file.rkt}:
|
||||||
|
|
||||||
@racketmod[
|
@racketmod[
|
||||||
racket/base
|
racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
"file.rkt")
|
"file.rkt")
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ Now we add some tests to check our library:
|
||||||
(check-equal? (my-* 1 2) 2 "Simple multiplication")
|
(check-equal? (my-* 1 2) 2 "Simple multiplication")
|
||||||
]
|
]
|
||||||
|
|
||||||
This is all it takes to define tests in RktUnit. Now
|
This is all it takes to define tests in RacUnit. Now
|
||||||
evaluate this file and see if the library is correct.
|
evaluate this file and see if the library is correct.
|
||||||
Here's the result I get:
|
Here's the result I get:
|
||||||
|
|
||||||
|
@ -63,13 +63,13 @@ expected: 2
|
||||||
The first @racket[#t] indicates the first test passed. The
|
The first @racket[#t] indicates the first test passed. The
|
||||||
second test failed, as shown by the message.
|
second test failed, as shown by the message.
|
||||||
|
|
||||||
Requiring RktUnit and writing checks is all you need to
|
Requiring RacUnit and writing checks is all you need to
|
||||||
get started testing, but let's take a little bit more time
|
get started testing, but let's take a little bit more time
|
||||||
to look at some features beyond the essentials.
|
to look at some features beyond the essentials.
|
||||||
|
|
||||||
Let's say we want to check that a number of properties hold.
|
Let's say we want to check that a number of properties hold.
|
||||||
How do we do this? So far we've only seen checks of a
|
How do we do this? So far we've only seen checks of a
|
||||||
single expression. In RktUnit a check is always a single
|
single expression. In RacUnit a check is always a single
|
||||||
expression, but we can group checks into units called test
|
expression, but we can group checks into units called test
|
||||||
cases. Here's a simple test case written using the
|
cases. Here's a simple test case written using the
|
||||||
@racket[test-begin] form:
|
@racket[test-begin] form:
|
||||||
|
@ -91,7 +91,7 @@ Evalute this and you should see an error message like:
|
||||||
A test
|
A test
|
||||||
... has a FAILURE
|
... has a FAILURE
|
||||||
name: check-pred
|
name: check-pred
|
||||||
location: (#<path:/Users/noel/programming/schematics/rktunit/branches/v3/doc/file-test.rkt> 14 6 252 22)
|
location: (#<path:/Users/noel/programming/schematics/racunit/branches/v3/doc/file-test.rkt> 14 6 252 22)
|
||||||
expression: (check-pred even? elt)
|
expression: (check-pred even? elt)
|
||||||
params: (#<procedure:even?> 9)
|
params: (#<procedure:even?> 9)
|
||||||
--------------------
|
--------------------
|
||||||
|
@ -147,13 +147,13 @@ tests, allowing you to choose how you run your tests. You
|
||||||
might, for example, print the results to the screen or log
|
might, for example, print the results to the screen or log
|
||||||
them to a file.
|
them to a file.
|
||||||
|
|
||||||
Let's run our tests, using RktUnit's simple textual user
|
Let's run our tests, using RacUnit's simple textual user
|
||||||
interface (there are fancier interfaces available but this
|
interface (there are fancier interfaces available but this
|
||||||
will do for our example). In @tt{file-test.rkt} add the
|
will do for our example). In @tt{file-test.rkt} add the
|
||||||
following lines:
|
following lines:
|
||||||
|
|
||||||
@racketblock[
|
@racketblock[
|
||||||
(require rktunit/text-ui)
|
(require racunit/text-ui)
|
||||||
|
|
||||||
(run-tests file-tests)
|
(run-tests file-tests)
|
||||||
]
|
]
|
||||||
|
@ -161,6 +161,6 @@ following lines:
|
||||||
Now evaluate the file and you should see similar output
|
Now evaluate the file and you should see similar output
|
||||||
again.
|
again.
|
||||||
|
|
||||||
These are the basics of RktUnit. Refer to the
|
These are the basics of RacUnit. Refer to the
|
||||||
documentation below for more advanced topics, such as
|
documentation below for more advanced topics, such as
|
||||||
defining your own checks. Have fun!
|
defining your own checks. Have fun!
|
|
@ -1,12 +1,12 @@
|
||||||
#lang scribble/doc
|
#lang scribble/doc
|
||||||
@(require "base.rkt")
|
@(require "base.rkt")
|
||||||
|
|
||||||
@title{@bold{RktUnit}: Unit Testing for Racket}
|
@title{@bold{RacUnit}: Unit Testing for Racket}
|
||||||
|
|
||||||
@author[(author+email "Noel Welsh" "noelwelsh@gmail.com")
|
@author[(author+email "Noel Welsh" "noelwelsh@gmail.com")
|
||||||
(author+email "Ryan Culpepper" "ryan_sml@yahoo.com")]
|
(author+email "Ryan Culpepper" "ryan_sml@yahoo.com")]
|
||||||
|
|
||||||
RktUnit is a unit-testing framework for Racket. It
|
RacUnit is a unit-testing framework for Racket. It
|
||||||
is designed to handle the needs of all Racket programmers,
|
is designed to handle the needs of all Racket programmers,
|
||||||
from novices to experts.
|
from novices to experts.
|
||||||
|
|
|
@ -12,7 +12,7 @@ There are also miscellaneous Scribble fixes.
|
||||||
|
|
||||||
@section{Version 3}
|
@section{Version 3}
|
||||||
|
|
||||||
This version of RktUnit is largely backwards compatible
|
This version of RacUnit is largely backwards compatible
|
||||||
with version 2 but there are significant changes to the
|
with version 2 but there are significant changes to the
|
||||||
underlying model, justifying incrementing the major version
|
underlying model, justifying incrementing the major version
|
||||||
number. These changes are best explained in
|
number. These changes are best explained in
|
|
@ -3,13 +3,13 @@
|
||||||
|
|
||||||
@title[#:tag "ui"]{User Interfaces}
|
@title[#:tag "ui"]{User Interfaces}
|
||||||
|
|
||||||
RktUnit provides a textual and a graphical user interface
|
RacUnit provides a textual and a graphical user interface
|
||||||
|
|
||||||
@section{Textual User Interface}
|
@section{Textual User Interface}
|
||||||
|
|
||||||
@defmodule[rktunit/text-ui]
|
@defmodule[racunit/text-ui]
|
||||||
|
|
||||||
The textual UI is in the @racketmodname[rktunit/text-ui] module.
|
The textual UI is in the @racketmodname[racunit/text-ui] module.
|
||||||
It is run via the @racket[run-tests] function.
|
It is run via the @racket[run-tests] function.
|
||||||
|
|
||||||
@defproc[(run-tests (test (or/c test-case? test-suite?))
|
@defproc[(run-tests (test (or/c test-case? test-suite?))
|
||||||
|
@ -33,15 +33,15 @@ information.
|
||||||
|
|
||||||
@section{Graphical User Interface}
|
@section{Graphical User Interface}
|
||||||
|
|
||||||
@defmodule[rktunit/gui]
|
@defmodule[racunit/gui]
|
||||||
|
|
||||||
RktUnit also provides a GUI test runner, available from the
|
RacUnit also provides a GUI test runner, available from the
|
||||||
@racketmodname[rktunit/gui] module.
|
@racketmodname[racunit/gui] module.
|
||||||
|
|
||||||
@defproc[(test/gui [test (or/c test-case? test-suite?)] ...)
|
@defproc[(test/gui [test (or/c test-case? test-suite?)] ...)
|
||||||
any]{
|
any]{
|
||||||
|
|
||||||
Creates a new RktUnit GUI window and runs each @racket[test]. The
|
Creates a new RacUnit GUI window and runs each @racket[test]. The
|
||||||
GUI is updated as tests complete.
|
GUI is updated as tests complete.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ GUI is updated as tests complete.
|
||||||
@defproc[(make-gui-runner)
|
@defproc[(make-gui-runner)
|
||||||
(-> (or/c test-case? test-suite?) ... any)]{
|
(-> (or/c test-case? test-suite?) ... any)]{
|
||||||
|
|
||||||
Creates a new RktUnit GUI window and returns a procedure that, when
|
Creates a new RacUnit GUI window and returns a procedure that, when
|
||||||
applied, runs the given tests and displays the results in the GUI.
|
applied, runs the given tests and displays the results in the GUI.
|
||||||
|
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@
|
||||||
;; CONSTANTS
|
;; CONSTANTS
|
||||||
|
|
||||||
(define BACKTRACE-NO-MESSAGE "No message.")
|
(define BACKTRACE-NO-MESSAGE "No message.")
|
||||||
(define LINK-MODULE-SPEC 'rktunit/private/gui/drracket-link)
|
(define LINK-MODULE-SPEC 'racunit/private/gui/drracket-link)
|
||||||
|
|
||||||
(define-namespace-anchor drracket-ns-anchor)
|
(define-namespace-anchor drracket-ns-anchor)
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
(require rktunit/gui)
|
(require racunit/gui)
|
||||||
(provide (all-from-out rktunit/gui))
|
(provide (all-from-out racunit/gui))
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#lang racket
|
#lang racket
|
||||||
(require rktunit/text-ui)
|
(require racunit/text-ui)
|
||||||
(provide (all-from-out rktunit/text-ui))
|
(provide (all-from-out racunit/text-ui))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
"check-test.rkt"
|
"check-test.rkt"
|
||||||
"check-info-test.rkt"
|
"check-info-test.rkt"
|
||||||
"format-test.rkt"
|
"format-test.rkt"
|
||||||
|
@ -17,12 +17,12 @@
|
||||||
"counter-test.rkt"
|
"counter-test.rkt"
|
||||||
"text-ui-util-test.rkt")
|
"text-ui-util-test.rkt")
|
||||||
|
|
||||||
(provide all-rktunit-tests
|
(provide all-racunit-tests
|
||||||
failure-tests)
|
failure-tests)
|
||||||
|
|
||||||
(define all-rktunit-tests
|
(define all-racunit-tests
|
||||||
(test-suite
|
(test-suite
|
||||||
"All RktUnit Tests"
|
"All RacUnit Tests"
|
||||||
check-tests
|
check-tests
|
||||||
base-tests
|
base-tests
|
||||||
check-info-tests
|
check-info-tests
|
|
@ -28,8 +28,8 @@
|
||||||
|
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/base)
|
racunit/private/base)
|
||||||
|
|
||||||
(provide base-tests)
|
(provide base-tests)
|
||||||
|
|
||||||
|
@ -37,45 +37,45 @@
|
||||||
(test-suite
|
(test-suite
|
||||||
"All tests for base"
|
"All tests for base"
|
||||||
(test-case
|
(test-case
|
||||||
"rktunit-test-case structure has a contract on name"
|
"racunit-test-case structure has a contract on name"
|
||||||
(check-exn exn:fail?
|
(check-exn exn:fail?
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(make-rktunit-test-case
|
(make-racunit-test-case
|
||||||
'foo
|
'foo
|
||||||
(lambda () #t)))))
|
(lambda () #t)))))
|
||||||
(test-case
|
(test-case
|
||||||
"rktunit-test-case structure has a contract on action"
|
"racunit-test-case structure has a contract on action"
|
||||||
(check-exn exn:fail?
|
(check-exn exn:fail?
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(make-rktunit-test-case
|
(make-racunit-test-case
|
||||||
"Name"
|
"Name"
|
||||||
#f))))
|
#f))))
|
||||||
(test-case
|
(test-case
|
||||||
"rktunit-test-suite has a contract on its fields"
|
"racunit-test-suite has a contract on its fields"
|
||||||
(check-exn exn:fail?
|
(check-exn exn:fail?
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(make-rktunit-test-suite
|
(make-racunit-test-suite
|
||||||
#f
|
#f
|
||||||
(list)
|
(list)
|
||||||
(lambda () 3)
|
(lambda () 3)
|
||||||
(lambda () 2))))
|
(lambda () 2))))
|
||||||
(check-exn exn:fail?
|
(check-exn exn:fail?
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(make-rktunit-test-suite
|
(make-racunit-test-suite
|
||||||
"Name"
|
"Name"
|
||||||
#f
|
#f
|
||||||
(lambda () 3)
|
(lambda () 3)
|
||||||
(lambda () 2))))
|
(lambda () 2))))
|
||||||
(check-exn exn:fail?
|
(check-exn exn:fail?
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(make-rktunit-test-suite
|
(make-racunit-test-suite
|
||||||
"Name"
|
"Name"
|
||||||
(list)
|
(list)
|
||||||
#f
|
#f
|
||||||
(lambda () 2))))
|
(lambda () 2))))
|
||||||
(check-exn exn:fail?
|
(check-exn exn:fail?
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(make-rktunit-test-suite
|
(make-racunit-test-suite
|
||||||
"Name"
|
"Name"
|
||||||
(list)
|
(list)
|
||||||
(lambda () 3)
|
(lambda () 3)
|
|
@ -4,20 +4,20 @@
|
||||||
;;;
|
;;;
|
||||||
;;; Copyright (C) 2003 by Noel Welsh.
|
;;; Copyright (C) 2003 by Noel Welsh.
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of RktUnit.
|
;;; This file is part of RacUnit.
|
||||||
|
|
||||||
;;; RktUnit is free software; you can redistribute it and/or
|
;;; RacUnit is free software; you can redistribute it and/or
|
||||||
;;; modify it under the terms of the GNU Lesser General Public
|
;;; modify it under the terms of the GNU Lesser General Public
|
||||||
;;; License as published by the Free Software Foundation; either
|
;;; License as published by the Free Software Foundation; either
|
||||||
;;; version 2.1 of the License, or (at your option) any later version.
|
;;; version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
;;; RktUnitis distributed in the hope that it will be useful,
|
;;; RacUnitis distributed in the hope that it will be useful,
|
||||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
;;; Lesser General Public License for more details.
|
;;; Lesser General Public License for more details.
|
||||||
|
|
||||||
;;; You should have received a copy of the GNU Lesser General Public
|
;;; You should have received a copy of the GNU Lesser General Public
|
||||||
;;; License along with RktUnit; if not, write to the Free Software
|
;;; License along with RacUnit; if not, write to the Free Software
|
||||||
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
;;; Author: Noel Welsh <noelwelsh@yahoo.com>
|
;;; Author: Noel Welsh <noelwelsh@yahoo.com>
|
||||||
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/check-info)
|
racunit/private/check-info)
|
||||||
|
|
||||||
(provide check-info-tests)
|
(provide check-info-tests)
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
|
|
||||||
(require racket/runtime-path
|
(require racket/runtime-path
|
||||||
srfi/1
|
srfi/1
|
||||||
rktunit
|
racunit
|
||||||
rktunit/private/check
|
racunit/private/check
|
||||||
rktunit/private/result
|
racunit/private/result
|
||||||
rktunit/private/test-suite)
|
racunit/private/test-suite)
|
||||||
|
|
||||||
(provide check-tests)
|
(provide check-tests)
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@
|
||||||
(cns (current-namespace)))
|
(cns (current-namespace)))
|
||||||
(parameterize ((current-namespace destns))
|
(parameterize ((current-namespace destns))
|
||||||
(namespace-require '(for-syntax racket/base))
|
(namespace-require '(for-syntax racket/base))
|
||||||
(namespace-require 'rktunit/private/check)
|
(namespace-require 'racunit/private/check)
|
||||||
;; First check that the right check macro got
|
;; First check that the right check macro got
|
||||||
;; used: ie that it didn't just compile the thing
|
;; used: ie that it didn't just compile the thing
|
||||||
;; as an application.
|
;; as an application.
|
|
@ -28,10 +28,10 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require racket/match
|
(require racket/match
|
||||||
rktunit
|
racunit
|
||||||
rktunit/private/counter
|
racunit/private/counter
|
||||||
rktunit/private/monad
|
racunit/private/monad
|
||||||
rktunit/private/hash-monad)
|
racunit/private/hash-monad)
|
||||||
|
|
||||||
(provide counter-tests)
|
(provide counter-tests)
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/check-info
|
racunit/private/check-info
|
||||||
rktunit/private/format)
|
racunit/private/format)
|
||||||
|
|
||||||
(provide format-tests)
|
(provide format-tests)
|
||||||
|
|
|
@ -28,9 +28,9 @@
|
||||||
|
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/monad
|
racunit/private/monad
|
||||||
rktunit/private/hash-monad)
|
racunit/private/hash-monad)
|
||||||
|
|
||||||
(provide hash-monad-tests)
|
(provide hash-monad-tests)
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
;; Commentary:
|
;; Commentary:
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/location)
|
racunit/private/location)
|
||||||
|
|
||||||
(provide location-tests)
|
(provide location-tests)
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/monad)
|
racunit/private/monad)
|
||||||
|
|
||||||
(provide monad-tests)
|
(provide monad-tests)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/result)
|
racunit/private/result)
|
||||||
|
|
||||||
(provide result-tests)
|
(provide result-tests)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/text-ui
|
racunit/text-ui
|
||||||
"all-rktunit-tests.rkt")
|
"all-racunit-tests.rkt")
|
||||||
|
|
||||||
(run-tests all-rktunit-tests)
|
(run-tests all-racunit-tests)
|
||||||
|
|
||||||
;; These tests should all error, so we switch the meaning of correct and incorrect. If the error display changes significantly, DrDr will catch it
|
;; These tests should all error, so we switch the meaning of correct and incorrect. If the error display changes significantly, DrDr will catch it
|
||||||
(parameterize ([current-error-port (current-output-port)]
|
(parameterize ([current-error-port (current-output-port)]
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit/private/check)
|
(require racunit/private/check)
|
||||||
|
|
||||||
;; This check should succeed
|
;; This check should succeed
|
||||||
(check = 1 1 0.0)
|
(check = 1 1 0.0)
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit/private/check
|
(require racunit/private/check
|
||||||
rktunit/private/test-case)
|
racunit/private/test-case)
|
||||||
|
|
||||||
;; These tests should succeeds
|
;; These tests should succeeds
|
||||||
(test-begin (check-eq? 1 1))
|
(test-begin (check-eq? 1 1))
|
|
@ -1,10 +1,10 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit/private/base
|
(require racunit/private/base
|
||||||
rktunit/private/check
|
racunit/private/check
|
||||||
rktunit/private/test-case
|
racunit/private/test-case
|
||||||
rktunit/private/test-suite
|
racunit/private/test-suite
|
||||||
rktunit/private/result)
|
racunit/private/result)
|
||||||
|
|
||||||
(provide test-case-tests)
|
(provide test-case-tests)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/check)
|
racunit/private/check)
|
||||||
|
|
||||||
(define run? #f)
|
(define run? #f)
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
racket/runtime-path
|
racket/runtime-path
|
||||||
srfi/1
|
srfi/1
|
||||||
srfi/13
|
srfi/13
|
||||||
rktunit
|
racunit
|
||||||
rktunit/private/util
|
racunit/private/util
|
||||||
rktunit/private/location)
|
racunit/private/location)
|
||||||
|
|
||||||
(provide test-tests)
|
(provide test-tests)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
(let ((destns (make-base-namespace))
|
(let ((destns (make-base-namespace))
|
||||||
(cns (current-namespace)))
|
(cns (current-namespace)))
|
||||||
(parameterize ((current-namespace destns))
|
(parameterize ((current-namespace destns))
|
||||||
(namespace-require 'rktunit)
|
(namespace-require 'racunit)
|
||||||
(check-exn (lambda (e)
|
(check-exn (lambda (e)
|
||||||
(check-pred exn:fail:syntax? e)
|
(check-pred exn:fail:syntax? e)
|
||||||
(check string-contains (exn-message e) msg))
|
(check string-contains (exn-message e) msg))
|
|
@ -33,8 +33,8 @@
|
||||||
racket/port
|
racket/port
|
||||||
srfi/1
|
srfi/1
|
||||||
srfi/13
|
srfi/13
|
||||||
rktunit
|
racunit
|
||||||
rktunit/text-ui)
|
racunit/text-ui)
|
||||||
|
|
||||||
(provide text-ui-tests)
|
(provide text-ui-tests)
|
||||||
|
|
||||||
|
@ -119,9 +119,9 @@
|
||||||
(with-all-output-to-string (failing-binary-test/complex-params)))])
|
(with-all-output-to-string (failing-binary-test/complex-params)))])
|
||||||
(check string-contains
|
(check string-contains
|
||||||
op
|
op
|
||||||
"(`(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
"`((0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
||||||
`(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
||||||
`(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14))")))
|
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14))")))
|
||||||
|
|
||||||
(test-case
|
(test-case
|
||||||
"Non-binary check output is pretty printed"
|
"Non-binary check output is pretty printed"
|
||||||
|
@ -129,9 +129,9 @@
|
||||||
(with-all-output-to-string (failing-test/complex-params)))])
|
(with-all-output-to-string (failing-test/complex-params)))])
|
||||||
(check string-contains
|
(check string-contains
|
||||||
op
|
op
|
||||||
"(`(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
"`((0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
||||||
`(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14)
|
||||||
`(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14))")))
|
(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14))")))
|
||||||
|
|
||||||
(test-case
|
(test-case
|
||||||
"Location trimmed when file is under current directory"
|
"Location trimmed when file is under current directory"
|
|
@ -27,8 +27,8 @@
|
||||||
;; Commentary:
|
;; Commentary:
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/text-ui-util)
|
racunit/private/text-ui-util)
|
||||||
|
|
||||||
(provide text-ui-util-tests)
|
(provide text-ui-util-tests)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require rktunit
|
(require racunit
|
||||||
rktunit/private/util)
|
racunit/private/util)
|
||||||
|
|
||||||
(provide util-tests)
|
(provide util-tests)
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
(check-true (procedure? make-failure-test))
|
(check-true (procedure? make-failure-test))
|
||||||
(check-equal? (make-arity-at-least 2)
|
(check-equal? (make-arity-at-least 2)
|
||||||
(procedure-arity make-failure-test))
|
(procedure-arity make-failure-test))
|
||||||
(check-pred rktunit-test-case?
|
(check-pred racunit-test-case?
|
||||||
(delay-test (make-failure-test "foo" string?)))))
|
(delay-test (make-failure-test "foo" string?)))))
|
||||||
|
|
||||||
(test-case
|
(test-case
|
Loading…
Reference in New Issue
Block a user