rlm@10: ;;; test_helper.clj -- part of the pretty printer for Clojure rlm@10: rlm@10: ; Copyright (c) Rich Hickey. All rights reserved. rlm@10: ; The use and distribution terms for this software are covered by the rlm@10: ; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) rlm@10: ; which can be found in the file epl-v10.html at the root of this distribution. rlm@10: ; By using this software in any fashion, you are agreeing to be bound by rlm@10: ; the terms of this license. rlm@10: ; You must not remove this notice, or any other, from this software. rlm@10: rlm@10: ;; Author: Tom Faulhaber rlm@10: ;; April 3, 2009 rlm@10: rlm@10: rlm@10: ;; This is just a macro to make my tests a little cleaner rlm@10: rlm@10: (ns clojure.test-clojure.pprint.test-helper rlm@10: (:use [clojure.test :only (deftest is)])) rlm@10: rlm@10: (defn- back-match [x y] (re-matches y x)) rlm@10: (defmacro simple-tests [name & test-pairs] rlm@10: `(deftest ~name rlm@10: ~@(for [[x y] (partition 2 test-pairs)] rlm@10: (if (instance? java.util.regex.Pattern y) rlm@10: `(is (#'clojure.test-clojure.pprint.test-helper/back-match ~x ~y)) rlm@10: `(is (= ~x ~y)))))) rlm@10: