Fixing 13
This commit is contained in:
parent
6d59b5e60d
commit
eee52585ed
|
@ -1,7 +1,9 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
(require (for-syntax racket/base)
|
(require (for-syntax racket/base)
|
||||||
racket/contract/base
|
racket/contract/base
|
||||||
|
rackunit/log
|
||||||
"format.rkt"
|
"format.rkt"
|
||||||
|
"base.rkt"
|
||||||
"check.rkt")
|
"check.rkt")
|
||||||
|
|
||||||
(provide current-test-name
|
(provide current-test-name
|
||||||
|
@ -48,11 +50,17 @@
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
((current-test-case-around)
|
((current-test-case-around)
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
(with-handlers ([(λ (e)
|
||||||
|
(and (exn:fail? e)
|
||||||
|
(not (exn:test? e))))
|
||||||
|
(λ (e)
|
||||||
|
(test-log! #f)
|
||||||
|
(raise e))])
|
||||||
(parameterize
|
(parameterize
|
||||||
([current-check-handler raise]
|
([current-check-handler raise]
|
||||||
[current-check-around check-around])
|
[current-check-around check-around])
|
||||||
(void)
|
(void)
|
||||||
expr ...))))]
|
expr ...)))))]
|
||||||
[_
|
[_
|
||||||
(raise-syntax-error
|
(raise-syntax-error
|
||||||
#f
|
#f
|
||||||
|
|
34
rackunit-test/tests/rackunit/pr/13.rkt
Normal file
34
rackunit-test/tests/rackunit/pr/13.rkt
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#lang racket/base
|
||||||
|
(require rackunit
|
||||||
|
rackunit/text-ui
|
||||||
|
racket/port
|
||||||
|
racket/match
|
||||||
|
racket/system)
|
||||||
|
|
||||||
|
(define a
|
||||||
|
(test-suite "Test Suite"
|
||||||
|
(test-case "Test Case"
|
||||||
|
(check-equal? #t #f))))
|
||||||
|
|
||||||
|
(define b
|
||||||
|
(test-suite "Test Suite"
|
||||||
|
(test-case "Test Case"
|
||||||
|
(check-equal? (error 'error "I'm an error!") #f))))
|
||||||
|
|
||||||
|
(module+ test
|
||||||
|
(define mode (getenv "PR13"))
|
||||||
|
(printf "\n\nRunning in mode ~v\n\n" mode)
|
||||||
|
(match mode
|
||||||
|
["a" (run-tests a)]
|
||||||
|
["a-raw" (check-equal? #t #f)]
|
||||||
|
["b" (run-tests b)]
|
||||||
|
["b-raw" (check-equal? (error 'error "I'm an error!") #f)]
|
||||||
|
[#f
|
||||||
|
(for ([v (in-list '("a" "a-raw" "b" "b-raw"))])
|
||||||
|
(putenv "PR13" v)
|
||||||
|
(printf "Readying mode ~v\n" v)
|
||||||
|
(check-equal?
|
||||||
|
(parameterize ([current-output-port (open-output-nowhere)])
|
||||||
|
(parameterize ([current-error-port (current-output-port)])
|
||||||
|
(system/exit-code "raco test 13.rkt")))
|
||||||
|
1))]))
|
Loading…
Reference in New Issue
Block a user