Fixing 13

This commit is contained in:
Jay McCarthy 2015-12-21 09:04:29 -05:00
parent 6d59b5e60d
commit eee52585ed
2 changed files with 43 additions and 1 deletions

View File

@ -1,7 +1,9 @@
#lang racket/base
(require (for-syntax racket/base)
racket/contract/base
rackunit/log
"format.rkt"
"base.rkt"
"check.rkt")
(provide current-test-name
@ -48,11 +50,17 @@
(syntax/loc stx
((current-test-case-around)
(lambda ()
(with-handlers ([(λ (e)
(and (exn:fail? e)
(not (exn:test? e))))
(λ (e)
(test-log! #f)
(raise e))])
(parameterize
([current-check-handler raise]
[current-check-around check-around])
(void)
expr ...))))]
expr ...)))))]
[_
(raise-syntax-error
#f

View 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))]))