File tree Expand file tree Collapse file tree 3 files changed +34
-8
lines changed
src/cider/nrepl/middleware/util
test/clj/cider/nrepl/middleware Expand file tree Collapse file tree 3 files changed +34
-8
lines changed Original file line number Diff line number Diff line change 161
161
:else form))))
162
162
163
163
(defn- contains-recur?
164
- " Return true if form is not a `loop` and a `recur` is found in it."
164
+ " Return true if form is not a `loop` or a `fn` and a `recur` is found in it."
165
165
[form]
166
166
(if (seq? form)
167
167
(case (first form)
168
168
recur true
169
169
loop* false
170
+ fn* false
170
171
(some contains-recur? (rest form)))))
171
172
172
173
(defn- dont-break?
302
303
(vary-meta f1 assoc :cider/instrumented (name (:name (meta br))))
303
304
f1))
304
305
(m/strip-meta f keys))]
305
- ; ; also strip meta of the meta
306
+ ; ; also strip meta of the meta
306
307
(with-meta f (strip-instrumentation-meta (meta f))))
307
308
f))
308
309
form))
Original file line number Diff line number Diff line change 155
155
(<-- {:value " 2" }) ; (let ...)
156
156
(<-- {:status [" done" ]})))
157
157
158
+ (deftest debug-recur-test
159
+ (--> :eval " (ns user.test.debug)" )
160
+ (<-- {:ns " user.test.debug" })
161
+ (<-- {:status [" done" ]})
162
+
163
+ (--> :eval
164
+ " #dbg
165
+ (defn foo [a]
166
+ (if (pos? a)
167
+ (recur (dec a))
168
+ :done))" )
169
+ (<-- {:value " #'user.test.debug/foo" })
170
+ (<-- {:status [" done" ]})
171
+
172
+ (testing " recur on fn"
173
+ (--> :eval " (foo 1)" )
174
+ (<-- {:debug-value " 1" :coor [3 1 1 ]}) ; a
175
+ (--> :continue )
176
+ (<-- {:debug-value " 0" :coor [3 1 1 ]}) ; a
177
+ (--> :continue )
178
+ (<-- {:value " :done" })
179
+ (<-- {:status [" done" ]})))
180
+
158
181
(deftest debug-ops-test
159
182
(--> :eval " (ns user.test.debug)" )
160
183
(<-- {:ns " user.test.debug" })
Original file line number Diff line number Diff line change 1
- (ns cider.nrepl.middleware.util.instrument-test
1
+ (ns ^:debugger cider.nrepl.middleware.util.instrument-test
2
2
(:require
3
3
[cider.nrepl.middleware.util.instrument :as t]
4
4
[clojure.set :as set]
70
70
(if (seq x)
71
71
(recur (rest x))
72
72
x)))
73
- '#{[(rest (bp x {:coor [2 2 1 1 ]} x)) [2 2 1 ]]
74
- [x [2 2 1 1 ]]
75
- [x [2 1 1 ]]
76
- [x [2 3 ]]
77
- [(seq (bp x {:coor [2 1 1 ]} x)) [2 1 ]]})))
73
+ '#{[x [2 2 1 1 ]]
74
+ [(fn* ([x] (if (bp (seq (bp x {:coor [2 1 1 ]} x)) {:coor [2 1 ]} (seq x))
75
+ (recur (bp (rest (bp x {:coor [2 2 1 1 ]} x)) {:coor [2 2 1 ]} (rest x)))
76
+ (bp x {:coor [2 3 ]} x))))
77
+ []]
78
+ [x [2 3 ]] [(seq (bp x {:coor [2 1 1 ]} x)) [2 1 ]] [x [2 1 1 ]]
79
+ [(rest (bp x {:coor [2 2 1 1 ]} x)) [2 2 1 ]]})))
78
80
79
81
; ; Factor this into a separate variable, otherwise Eastwood fails with
80
82
; ; "method code too large".
You can’t perform that action at this time.
0 commit comments