Skip to content

Commit

Permalink
[#36] Printing in lazy value doesn't print in client
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Feb 12, 2021
1 parent 9c424a0 commit 15ff3c1
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/babashka/nrepl/server_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,20 @@
(if (= status ["done"])
output
(recur (str output out)))))))))

(testing "output in lazy seq"
(bencode/write-bencode os {"op" "eval"
"code" (str '(map
(fn [x]
(println "It prints in client" x)
(inc x)) [10 20]))
"session" session "id" (new-id!)})
(is (str/includes?
(loop [output ""]
(let [{:keys [status out]} (read-reply in session @id)]
(if (= status ["done"])
output
(recur (str output out)))))
"It prints in client")))
(testing "error"
(bencode/write-bencode os {"op" "eval" "code" "(binding [*out* *err*] (dotimes [i 3] (println \"Hello\")))"
"session" session "id" (new-id!)})
Expand Down

0 comments on commit 15ff3c1

Please sign in to comment.