;;; Time-stamp: <2004-12-21 11:24:26 noel>
;;; Copyright (C) 2004 by Noel Welsh.

;;; This library is free software; you can redistribute it
;;; and/or modify it under the terms of the GNU Lesser
;;; General Public License as published by the Free Software
;;; Foundation; either version 2.1 of the License, or (at
;;; your option) any later version.

;;; Web testingis distributed in the hope that it will be
;;; useful, but WITHOUT ANY WARRANTY; without even the
;;; implied warranty of MERCHANTABILITY or FITNESS FOR A
;;; PARTICULAR PURPOSE.  See the GNU Lesser General Public
;;; License for more details.

;;; You should have received a copy of the GNU Lesser
;;; General Public License along with Web testing; if not,
;;; write to the Free Software Foundation, Inc., 59 Temple
;;; Place, Suite 330, Boston, MA 02111-1307 USA

;;; Author: Noel Welsh <noelwelsh@yahoo.com>
;; Commentary:

(module util mzscheme

  (provide require/expose

  (require "test.ss")
  ;; Requires a module and exposes some of its unprovided
  ;; (non-syntax!)  identifiers.
  ;; USAGE: (require/expose MODULE-NAME (IDS ...))
  ;;   where MODULE-NAME is as in the MzScheme manual (i.e.,
  ;;   a standard module spec) and IDS are the un-provided
  ;;   identifiers that you wish to expose in the current
  ;;   module.
  ;; Based on a macro by Raymond Racine
  ;; (rracine@adelphia.net) posted to plt-scheme in Dec
  ;; 2003.  By Richard C. Cobbe <cobbe@ccs.neu.edu>
  (define-syntax require/expose
    (syntax-rules ()
      [(_ mod (ids ...))
         (require mod)
         (define-values (ids ...)
           (let ([ns (module->namespace 'mod)])
             (parameterize ([current-namespace ns])
                (namespace-variable-value 'ids)...)))))]))

  (define-syntax make-test-suite*
    (syntax-rules ()
      ((make-test-suite* name (case-name case-body ...) ...)
        (make-test-case case-name case-body ...) ...))))

  (define-simple-assertion (assert-regexp-match regex string)
    (regexp-match regex string))