language/dracula-module-begin.scm
(module dracula-module-begin mzscheme
  (require (lib "etc.ss")
           (lib "unit.ss"))
  
  (require-for-syntax "dracula-module-begin-util.scm"
                      "event-form.scm")
  
  (provide dracula-module-begin)

  (define-for-syntax (test-form? stx)
    (syntax-case stx ()
      [(head arg ...)
       (and (identifier? #'head)
            (memq (syntax-e #'head)
                  '(check-expect check-within check-error generate-report)))
       #t]
      [_ #f]))

  (define-syntax (dracula-module-begin stx)
    (syntax-case stx ()
      [(d-m-b form ...)
       (syntax/loc stx (#%module-begin (dracula-top-level form) ...))]))

  (define-syntax (dracula-top-level stx)
    (syntax-case stx ()
      [(d-t-l form)
       (let ([form-stx (syntax form)])
         (cond
          [(event-form? form-stx) form-stx]
          [(test-form? form-stx) form-stx]
          [else (syntax/loc form-stx ((current-print) form))]))]))

  )