Fixing PR14168
original commit: 6d06e8c66d4d3f7af5fc824e3bc4cdb7f056709d
This commit is contained in:
parent
cb73ddc016
commit
8f737bae4e
pkgs/rackunit-pkgs
|
@ -1,5 +1,6 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
(require (for-syntax racket/base)
|
(require (for-syntax racket/base)
|
||||||
|
racket/contract/base
|
||||||
"format.rkt"
|
"format.rkt"
|
||||||
"check.rkt")
|
"check.rkt")
|
||||||
|
|
||||||
|
@ -58,12 +59,16 @@
|
||||||
"Correct form is (test-begin expr ...)"
|
"Correct form is (test-begin expr ...)"
|
||||||
stx)]))
|
stx)]))
|
||||||
|
|
||||||
(define-syntax test-case
|
(define-syntax (test-case stx)
|
||||||
(syntax-rules ()
|
(syntax-case stx ()
|
||||||
[(test-case name expr ...)
|
[(_ name expr ...)
|
||||||
(parameterize
|
(quasisyntax/loc stx
|
||||||
([current-test-name name])
|
(parameterize
|
||||||
(test-begin expr ...))]))
|
([current-test-name
|
||||||
|
(contract string? name
|
||||||
|
'#,(syntax-source-module #'name #t)
|
||||||
|
'#,(syntax-source-module #'test-case #t))])
|
||||||
|
(test-begin expr ...)))]))
|
||||||
|
|
||||||
(define-syntax before
|
(define-syntax before
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
(test-suite
|
(test-suite
|
||||||
"test-case-tests"
|
"test-case-tests"
|
||||||
|
|
||||||
|
(check-exn #rx"contract" (λ () (test-case 'foo)))
|
||||||
|
|
||||||
(test-case
|
(test-case
|
||||||
"test-begin terminates when sub-expression fails"
|
"test-begin terminates when sub-expression fails"
|
||||||
(let ([fail? #f])
|
(let ([fail? #f])
|
||||||
|
@ -52,6 +54,8 @@
|
||||||
(test-case
|
(test-case
|
||||||
"dummy"
|
"dummy"
|
||||||
(define yes #t)
|
(define yes #t)
|
||||||
(check-true yes)))))))
|
(check-true yes)))))))))
|
||||||
|
|
||||||
))
|
(module+ test
|
||||||
|
(require rackunit/text-ui)
|
||||||
|
(run-tests test-case-tests))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user