Commit 3d7e455 1 parent a468862 commit 3d7e455 Copy full SHA for 3d7e455
File tree 2 files changed +0
-32
lines changed
2 files changed +0
-32
lines changed Original file line number Diff line number Diff line change 254
254
{:pre [(integer? max-nested-depth)]}
255
255
(inspect-render (assoc inspector :max-nested-depth max-nested-depth)))
256
256
257
- (defn eval-and-inspect
258
- " Evaluate the given expression where `v` is bound to the currently inspected
259
- value. Open the evaluation result in the inspector."
260
- [inspector expr]
261
- (let [{:keys [current-page value]} inspector
262
- eval-fn `(fn [~'v] ~(read-string expr))
263
- result ((eval eval-fn) value)]
264
- (-> (update inspector :stack conj value)
265
- (update :pages-stack conj current-page)
266
- (assoc :current-page 0 )
267
- (update :path conj '<unknown>)
268
- (inspect-render result))))
269
-
270
257
(defn def-current-value
271
258
" Define the currently inspected value as a var with the given name in the
272
259
provided namespace."
Original file line number Diff line number Diff line change 365
365
(is (= 2 (:current-page ins)))
366
366
(is (= 4 (:current-page (inspect/up ins))))))))
367
367
368
- (deftest eval-and-inspect-test
369
- (testing " evaluate expr in the context of currently inspected value"
370
- (is (match? (list " Class"
371
- " : " (list :value " java.lang.String" number?)
372
- '(:newline )
373
- " Value: " " \" 1001\" "
374
- '(:newline )
375
- '(:newline )
376
- " --- Print:"
377
- '(:newline )
378
- " " " 1001"
379
- '(:newline ))
380
- (-> eval-result
381
- inspect
382
- (inspect/down 2 )
383
- (inspect/down 2 )
384
- (inspect/eval-and-inspect " (str (+ v 1000))" )
385
- render)))))
386
-
387
368
(deftest def-value-test
388
369
(testing " define var with the currently inspected value"
389
370
(-> eval-result
You can’t perform that action at this time.
0 commit comments