We're updating the issue view to help you get more done. 

clojure.test.junit/with-junit-output doesn't handle multiple expressions

Description

From the docstring description, and the use of ~@body, the intent of with-junit-output was to support a body containing multiple forms (for side-effects). However, calling it with multiple expressions will yield an error about the bindings in the let form.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 (defmacro with-junit-output "Execute body with modified test-is reporting functions that write JUnit-compatible XML output." {:added "1.1"} [& body] `(binding [t/report junit-report *var-context* (list) *depth* 1] (t/with-test-out (println "<?xml version=\"1.0\" encoding=\"UTF-8\"?>") (println "<testsuites>")) (let [result# ~@body] (t/with-test-out (println "</testsuites>")) result#)))

Cause: The ~@body in the macro is spliced into code expecting a single expression.

Approach: Wrap a (do ) around the ~@body.

Patch: clj-1485.patch

Screened by: Alex Miller

Environment

None

Status

Assignee

Unassigned

Reporter

Howard Lewis Ship

Labels

Approval

Ok

Patch

Code

Fix versions

Affects versions

Release 1.6

Priority

Minor