teachpacks/testing.ss
;; DV 3/23/2007: Made this export a unit to conform to new teachpack protocol.
;; Also included the three form names to src/lang/event-form.ss.
(module testing mzscheme
  (require (lib "unit.ss")
           (for-syntax "../proof/wrapper.ss")
           (prefix htdp: test-engine/scheme-tests))
  
  (provide teachpack^ teachpack@)

  (define (do-generate-report)
    (htdp:run-tests)
    (htdp:display-results)
    't)
  
  (define-signature teachpack^ 
    [(define-syntaxes (check-expect check-within check-error generate-report)
       (values
        (lambda (stx)
          (syntax-case stx () 
            [(_ x ...)
             (dracula-event
              #`(begin
                  #,(syntax/loc stx (htdp:check-expect x ...))
                  'check-expect-finished))]))
        (lambda (stx)
          (syntax-case stx ()
            [(_ x ...)
             (dracula-event
              #`(begin
                  #,(syntax/loc stx (htdp:check-within x ...))
                  'check-within-finished))]))
        (lambda (stx)
          (syntax-case stx ()
            [(_ x ...)
             (dracula-event
              #`(begin
                  #,(syntax/loc stx (htdp:check-error x ...))
                  'check-error-finished))]))
        (lambda (stx)
          (syntax-case stx ()
            [(_) (dracula-event (syntax/loc stx (do-generate-report)))]))))])
  
  (define-unit teachpack@
    (import)
    (export teachpack^))
  )