1. Meikel Brandmeyer
  2. vimclojure

Commits

Meikel Brandmeyer  committed b384136

Rebind clojure.test/*test-out* in the repl

Fixes #55

  • Participants
  • Parent commits 316170f
  • Branches default

Comments (0)

Files changed (1)

File src/main/clojure/vimclojure/repl.clj

View file
 ; THE SOFTWARE.
 
 (ns vimclojure.repl
+  (:require
+    clojure.test)
   (:use
      [vimclojure.util :only (stream->seq pretty-print pretty-print-causetrace)])
   (:import
   invokations. The members correspond to the Vars as bound be with-binding."}
   repl
   :id :ns :warn-on-reflection :print-meta :print-length :print-level
-  :compile-path :command-line-args :expr1 :expr2 :expr3 :exception :line)
+  :compile-path :command-line-args :expr1 :expr2 :expr3 :exception :test-out
+  :line)
 
 (defn make-repl
   "Create a new Repl."
                :expr3              nil
                :exception          nil
                :print-pretty       vimclojure.repl/*print-pretty*
+               :test-out           nil
                :line               0)))
 
 (defn start
        #'*2                   (the-repl :expr2)
        #'*3                   (the-repl :expr3)
        #'*e                   (the-repl :exception)
-       #'vimclojure.repl/*print-pretty* (the-repl :print-pretty)}
+       #'vimclojure.repl/*print-pretty* (the-repl :print-pretty)
+       #'clojure.test/*test-out* (if-let [test-out (the-repl :test-out)]
+                                   test-out
+                                   *out*)}
       (try
         (thunk)
         (finally
                      :expr3              *3
                      :exception          *e
                      :print-pretty       vimclojure.repl/*print-pretty*
+                     :test-out           (let [test-out clojure.test/*test-out*]
+                                           (when-not (identical? test-out *out*)
+                                             test-out))
                      :line               (dec (.getLineNumber *in*))))))))))
 
 (defmacro with-repl