cider-nrepl icon indicating copy to clipboard operation
cider-nrepl copied to clipboard

enlighten deftest forms

Open ryfow opened this issue 8 years ago • 1 comments

Enlighten mode doesn't work with deftest forms because deftest puts the test code in the var's metadata and puts a call to test-var in the fn body.

I think this can be resolved with something like what the debugger does but I can't say I really understand what's going on there.

Expected behavior

deftest forms that are evalled with enlighten-mode on would show enlighten info when run.

Actual behavior

enlighten info is not shown

Steps to reproduce the problem

Step 1: Write some code like this:

(require '[clojure.test :refer :all])

(defn not-a-test []
  (let [a (System/currentTimeMillis)]
    (is (= 0 (mod a 3)))))

(deftest a-test
  (let [a (System/currentTimeMillis)]
    (is (= 0 (mod a 3)))))

Step 2: Turn on enlighten mode and eval both forms

Step 3: Run (not-a-test) and (a-test)

See that enlighten displayed the value of a for not-a-test but did not for a-test

Environment & Version information

cider-nrepl version

0.14.0

Java version

1.8

Operating system

Mac OS X

ryfow avatar Oct 27 '16 20:10 ryfow

Yes, the debugger needed some special handling in order to support deftest forms, so enlighten will probably require something like that as well.

Malabarba avatar Nov 02 '16 19:11 Malabarba