File tree Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Expand file tree Collapse file tree 3 files changed +30
-3
lines changed Original file line number Diff line number Diff line change 55(def ^:dynamic *test-buffer* nil )
66
77(defn read-test-buffer []
8- (String. (.toByteArray *test-buffer*)))
8+ (when *test-buffer*
9+ (String. (.toByteArray *test-buffer*))))
910
1011(def active-buffers (atom #{}))
1112
Original file line number Diff line number Diff line change 3232
3333(defn- testing-vars-str [{:keys [file line]}]
3434 (let [test-var (first test/*testing-vars*)]
35- (str (:clojure-frame *fonts*) (-> test-var meta :ns ns-name) " /"
36- (:function-name *fonts*) (-> test-var meta :name ) (:reset *fonts*)
35+ (str (:clojure-frame *fonts*)
36+ (if test-var
37+ (-> test-var meta :ns ns-name)
38+ " unknown-namespace" )
39+ " /"
40+ (:function-name *fonts*)
41+ (if test-var
42+ (-> test-var meta :name )
43+ " unknown-test" )
44+ (:reset *fonts*)
3745 (when (or file line)
3846 (str " (" (:source *fonts*) file " :" line (:reset *fonts*) " )" )))))
3947
Original file line number Diff line number Diff line change 4848 pretty-nil
4949 " \n " )
5050 result))))
51+
52+ (deftest report-outside-testing-vars
53+ (let [pretty-nil (puget/pprint-str nil {:print-color true
54+ :print-meta false })]
55+ (is (= (str " \n FAIL in unknown-namespace/unknown-test (report_test.clj:10)\n foo\n expected: "
56+ pretty-nil
57+ " \n actual: "
58+ pretty-nil
59+ " \n " )
60+ (with-out-str
61+ (binding [*testing-vars* nil
62+ pretty/*fonts* {}
63+ *report-counters* (ref *initial-report-counters*)
64+ *test-out* *out*]
65+ (pretty/report {:type :fail
66+ :message " foo"
67+ :file " report_test.clj"
68+ :line 10 })))))))
You can’t perform that action at this time.
0 commit comments