diff options
author | Stuart Halloway <stu@thinkrelevance.com> | 2009-04-05 16:02:37 +0000 |
---|---|---|
committer | Stuart Halloway <stu@thinkrelevance.com> | 2009-04-05 16:02:37 +0000 |
commit | 47024875854f8bed0301f9927d7faa6e0e83b595 (patch) | |
tree | c7daeb1071a26f59ceed2416a34f7914536f0a9e /src/clojure/contrib/test_clojure/clojure_main.clj | |
parent | 57571874b35cd8df77ccdc96a4e158c74478280e (diff) |
java-util: the-str and with-system-properties
Diffstat (limited to 'src/clojure/contrib/test_clojure/clojure_main.clj')
-rw-r--r-- | src/clojure/contrib/test_clojure/clojure_main.clj | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/clojure/contrib/test_clojure/clojure_main.clj b/src/clojure/contrib/test_clojure/clojure_main.clj index 80629a3d..f1a96465 100644 --- a/src/clojure/contrib/test_clojure/clojure_main.clj +++ b/src/clojure/contrib/test_clojure/clojure_main.clj @@ -7,34 +7,12 @@ ;; from this software. (ns clojure.contrib.test-clojure.clojure-main - (:use clojure.contrib.test-is) + (:use [clojure.contrib.java-utils :only (with-system-properties)] + clojure.contrib.test-is) (:require [clojure.main :as main])) -(defn- set-properties - [settings] - (doseq [[name val] settings] - (if val - (System/setProperty name val) - (System/clearProperty name)))) - -(defmacro with-properties - "setting => property-name value - - Sets the system properties to the supplied values, executes the body, and - sets the properties back to their original values. Values of nil are - translated to a clearing of the property." - [settings & body] - `(let [settings# ~(apply hash-map settings) - current# (map (fn [p#] [p# (System/getProperty p#)]) - (keys settings#))] - (set-properties settings#) - (try - ~@body - (finally - (set-properties current#))))) - (deftest compile-path-respects-java-property ;; Bug fixed in r1177; previously was hardwired to the compile-time path. - (with-properties ["clojure.compile.path" "compile path test"] + (with-system-properties {:clojure.compile.path "compile path test"} (main/with-bindings (is (= "compile path test" *compile-path*))))) |