我相信这是“按设计”,并且一些扩展 clojure.test
行为的工具依赖于它。《clojure.test》 命名空间文档字符串中有这样一条说明
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))