Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update pallet.debug functions to work in plan functions

  • Loading branch information...
commit 50750b4397dc3b98fedf42308ef38274d11e3a3d 1 parent a0a7cf3
@hugoduncan hugoduncan authored
Showing with 18 additions and 17 deletions.
  1. +11 −11 src/pallet/debug.clj
  2. +7 −6 test/pallet/debug_test.clj
View
22 src/pallet/debug.clj
@@ -9,19 +9,19 @@
the supplied format string.
(log-session session \"The session is %s\")"
- ([session]
- (log-session session "%s"))
- ([session format-string]
- (logging/debug (format format-string (pr-str session)))
- session))
+ ([] (log-session "%s"))
+ ([format-string]
+ (fn [session]
+ (logging/debug (format format-string (pr-str session)))
+ [nil session])))
(defn print-session
"A crate function that will print the session map to *out*, using the supplied
format string.
- (print-session session \"The session is %s\")"
- ([session]
- (print-session session "%s"))
- ([session format-string]
- (println (format format-string (pr-str session)))
- session))
+ (print-session \"The session is %s\")"
+ ([] (print-session "%s"))
+ ([format-string]
+ (fn [session]
+ (println (format format-string (pr-str session)))
+ [nil session])))
View
13 test/pallet/debug_test.clj
@@ -10,14 +10,15 @@
(deftest print-session-test
(let [m {:a 1 :b "2"}]
(testing "default format string"
- (is (= (pr-str m) (string/trim (with-out-str (print-session m)))))
- (is (= m (test-utils/suppress-output (print-session m)))))
+ (is (= (pr-str m) (string/trim (with-out-str ((print-session) m)))))
+ (is (= [nil m] (test-utils/suppress-output ((print-session) m)))))
(testing "explicit format string"
(is (= (format "abc %s\n" (pr-str m))
- (with-out-str (print-session m "abc %s"))))
- (is (= m (test-utils/suppress-output (print-session m "abc %s")))))))
+ (with-out-str ((print-session "abc %s") m))))
+ (is (= [nil m]
+ (test-utils/suppress-output ((print-session "abc %s") m)))))))
(deftest log-session-test
(let [m {:a 1 :b "2"}]
- (is (= m (logutils/suppress-logging (log-session m))))
- (is (= m (logutils/suppress-logging (log-session m "%s"))))))
+ (is (= [nil m] (logutils/suppress-logging ((log-session) m))))
+ (is (= [nil m] (logutils/suppress-logging ((log-session "%s") m))))))
Please sign in to comment.
Something went wrong with that request. Please try again.