Uploaded image for project: 'Clojure'
  1. CLJ-1209

clojure.test does not print ex-info in error reports

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: Release 1.10
    • Labels:
    • Approval:
      Ok
    • Patch:
      Code

      Description

      clojure.test does not print the data attached to ExceptionInfo in error reports.

      (use 'clojure.test)
      (deftest ex-test (throw (ex-info "err" {:some :data})))
      (ex-test)
      
      ERROR in (ex-test) (core.clj:4591)
      Uncaught exception, not in assertion.
      expected: nil
        actual: clojure.lang.ExceptionInfo: err
       at clojure.core$ex_info.invoke (core.clj:4591)
          user/fn (NO_SOURCE_FILE:2)
          clojure.test$test_var$fn__7666.invoke (test.clj:704)
          clojure.test$test_var.invoke (test.clj:704)
          ...
      

      Approach: In clojure.stacktrace, which clojure.test uses for printing exceptions, add a check for ex-data and pr it.

      After:

      ERROR in (ex-test) (core.clj:4591)
      Uncaught exception, not in assertion.
      expected: nil
        actual: clojure.lang.ExceptionInfo: err
      {:some :data}
       at clojure.core$ex_info.invoke (core.clj:4591)
          user/fn (NO_SOURCE_FILE:3)
          clojure.test$test_var$fn__7667.invoke (test.clj:704)
          clojure.test$test_var.invoke (test.clj:704)
      

      Patch: 0002-CLJ-1209-show-ex-data-in-clojure-test.patch

      Screened by: Alex Miller

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              thheller Thomas Heller
            • Votes:
              5 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: