From bf0293b932314913bf7f3235f2ad79672cf9a226 Mon Sep 17 00:00:00 2001 From: Brandon Bloom Date: Thu, 21 Jun 2012 16:17:28 -0700 Subject: [PATCH] Fix (println 1 1) => "11\n" instead of "1 1\n" --- src/cljs/cljs/core.cljs | 22 +++++++++++----------- test/cljs/cljs/core_test.cljs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/cljs/cljs/core.cljs b/src/cljs/cljs/core.cljs index d7ede71..cf6166a 100644 --- a/src/cljs/cljs/core.cljs +++ b/src/cljs/cljs/core.cljs @@ -6120,11 +6120,11 @@ reduces them without incurring seq initialization" :else (list "#<" (str obj) ">"))))) (defn- pr-sb [objs opts] - (let [first-obj (first objs) - sb (gstring/StringBuffer.)] - (doseq [obj objs] - (when-not (identical? obj first-obj) - (.append sb " ")) + (let [sb (gstring/StringBuffer.)] + (doseq [string (pr-seq (first objs) opts)] + (.append sb string)) + (doseq [obj (next objs)] + (.append sb " ") (doseq [string (pr-seq obj opts)] (.append sb string))) sb)) @@ -6146,12 +6146,12 @@ reduces them without incurring seq initialization" "Prints a sequence of objects using string-print, observing all the options given in opts" [objs opts] - (let [first-obj (first objs)] - (doseq [obj objs] - (when-not (identical? obj first-obj) - (string-print " ")) - (doseq [string (pr-seq obj opts)] - (string-print string))))) + (doseq [string (pr-seq (first objs) opts)] + (string-print string)) + (doseq [obj (next objs)] + (string-print " ") + (doseq [string (pr-seq obj opts)] + (string-print string)))) (defn newline [opts] (string-print "\n") diff --git a/test/cljs/cljs/core_test.cljs b/test/cljs/cljs/core_test.cljs index 8f7668a..e4676c9 100644 --- a/test/cljs/cljs/core_test.cljs +++ b/test/cljs/cljs/core_test.cljs @@ -212,7 +212,7 @@ (assert (= (hash-map :foo 5) (assoc (cljs.core.ObjMap. nil (array) (js-obj)) :foo 5))) - (assert (= "\"asdf\"" (pr-str "asdf"))) + (assert (= "\"asdf\" \"asdf\"" (pr-str "asdf" "asdf"))) (assert (= "[1 true {:a 2, :b #\"x\\\"y\"} #]" (pr-str [1 true {:a 2 :b #"x\"y"} (array 3 4)]))) -- 1.7.9.1