view src/clojure/test_clojure/pprint/test_helper.clj @ 10:ef7dbbd6452c

added clojure source goodness
author Robert McIntyre <rlm@mit.edu>
date Sat, 21 Aug 2010 06:25:44 -0400
parents
children
line wrap: on
line source
1 ;;; test_helper.clj -- part of the pretty printer for Clojure
3 ; Copyright (c) Rich Hickey. All rights reserved.
4 ; The use and distribution terms for this software are covered by the
5 ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
6 ; which can be found in the file epl-v10.html at the root of this distribution.
7 ; By using this software in any fashion, you are agreeing to be bound by
8 ; the terms of this license.
9 ; You must not remove this notice, or any other, from this software.
11 ;; Author: Tom Faulhaber
12 ;; April 3, 2009
15 ;; This is just a macro to make my tests a little cleaner
17 (ns clojure.test-clojure.pprint.test-helper
18 (:use [clojure.test :only (deftest is)]))
20 (defn- back-match [x y] (re-matches y x))
21 (defmacro simple-tests [name & test-pairs]
22 `(deftest ~name
23 ~@(for [[x y] (partition 2 test-pairs)]
24 (if (instance? java.util.regex.Pattern y)
25 `(is (#'clojure.test-clojure.pprint.test-helper/back-match ~x ~y))
26 `(is (= ~x ~y))))))