Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed corner case in c.c.profile print-summary

  • Loading branch information...
commit 6dd033d9e12337f6630faa3d3f5c2e901a28c4f4 1 parent ebf0d21
@stuarthalloway stuarthalloway authored
View
2  src/main/clojure/clojure/contrib/profile.clj
@@ -95,7 +95,7 @@ profiling code."} *enable-profiling* true)
(defn print-summary
"Prints a table of the results returned by summarize."
[profile-summary]
- (let [name-width (apply max (map (comp count name) (keys profile-summary)))
+ (let [name-width (apply max 1 (map (comp count name) (keys profile-summary)))
fmt-string (str "%" name-width "s %8d %8d %8d %8d %8d%n")]
(printf (.replace fmt-string \d \s)
"Name" "mean" "min" "max" "count" "sum")
View
8 src/test/clojure/clojure/contrib/test_profile.clj
@@ -0,0 +1,8 @@
+(ns clojure.contrib.test-profile
+ (:use clojure.test
+ clojure.contrib.profile))
+
+(deftest test-print-summary
+ (testing "doesn't blow up with no data (assembla #31)"
+ (is (= "Name mean min max count sum\n"
+ (with-out-str (print-summary {}))))))
Please sign in to comment.
Something went wrong with that request. Please try again.