我认为这是“如设计”的,并且有些扩展 clojure.test
行为的工具依赖于它。The clojure.test
ns 的文档字符串中有以下几点说明
SAVING TEST OUTPUT TO A FILE
All the test reporting functions write to the var *test-out*. By
default, this is the same as *out*, but you can rebind it to any
PrintWriter. For example, it could be a file opened with
clojure.java.io/writer.
有一个 with-test-out
宏,它是专门用于测试报告器以便它们可以依赖于此行为的
(defmacro with-test-out
"Runs body with *out* bound to the value of *test-out*."
{:added "1.1"}
[& body]
`(binding [*out* *test-out*]
~@body))