|
470 | 470 | (<-- {:status ["done"]}))
|
471 | 471 |
|
472 | 472 | (deftest step-in-to-function-in-current-project-test
|
473 |
| - ;; We use misc/as-sym just because it's a simple function that's part of the |
474 |
| - ;; current project, and we want to ensure that the debugger can find and |
475 |
| - ;; instrument the code of a function that lives in a regular file on the |
476 |
| - ;; classpath (as opposed to, for example, in a jar, which is tested later). |
| 473 | + ;; We want to ensure that the debugger can find and instrument the code of a |
| 474 | + ;; function that lives in a regular file on the classpath (as opposed to, |
| 475 | + ;; for example, in a jar, which is tested later). |
477 | 476 | (--> :eval "(ns user.test.step-in
|
478 |
| - (:require [cider.nrepl.middleware.util.misc :as misc]))") |
| 477 | + (:require [cider.nrepl.middleware.debug-integration-test.fn :as test-fn]))") |
479 | 478 | (<-- {:ns "user.test.step-in"})
|
480 | 479 | (<-- {:status ["done"]})
|
481 | 480 |
|
482 | 481 | (--> :eval
|
483 | 482 | "#dbg
|
484 | 483 | (defn foo [s]
|
485 |
| - (misc/as-sym s))") |
| 484 | + (test-fn/as-sym s))") |
486 | 485 | (<-- {:value "#'user.test.step-in/foo"})
|
487 | 486 | (<-- {:status ["done"]})
|
488 | 487 |
|
|
491 | 490 | (<-- {:debug-value "\"bar\""})
|
492 | 491 | (--> :in)
|
493 | 492 |
|
494 |
| - ;; Note - if anyone changes misc.clj, this could fail: |
495 |
| - (let [msg (<-- {:line 32 |
| 493 | + ;; Note - if changing test/src/cider/nrepl/middleware/debug_integration_test/fn.clj, also change this: |
| 494 | + (let [msg (<-- {:line 7 |
496 | 495 | :column 0
|
497 | 496 | :debug-value "\"bar\""
|
498 | 497 | :coor [3 1 1]
|
499 | 498 | :locals [["x" "\"bar\""]]})
|
500 |
| - misc-file (:file msg)] |
501 |
| - (is (.endsWith misc-file "/cider/nrepl/middleware/util/misc.clj")) |
502 |
| - (is (.startsWith misc-file "file:/")) |
| 499 | + file (:file msg)] |
| 500 | + (is (.endsWith file "/cider/nrepl/middleware/debug_integration_test/fn.clj")) |
| 501 | + (is (.startsWith file "file:/")) |
503 | 502 |
|
504 |
| - ;; Step out a couple of times, taking us out of misc/as-sym |
| 503 | + ;; Step out a couple of times, taking us out of test-fn/as-sym |
505 | 504 | (--> :out)
|
506 |
| - (<-- {:debug-value "false" :file misc-file}) |
| 505 | + (<-- {:debug-value "false" :file file}) |
507 | 506 | (--> :out)
|
508 |
| - (<-- {:debug-value "bar" :file misc-file}) |
| 507 | + (<-- {:debug-value "bar" :file file}) |
509 | 508 |
|
510 | 509 | ;; Next step should take us back into foo
|
511 | 510 | (--> :next)
|
|
518 | 517 | (--> :eval "(foo \"bar\")")
|
519 | 518 | (<-- {:debug-value "\"bar\""})
|
520 | 519 | (--> :next)
|
521 |
| - (<-- {:debug-value "bar" :coor [3]}) ; return value of (misc/as-sym ...) |
| 520 | + (<-- {:debug-value "bar" :coor [3]}) ; return value of (test-fn/as-sym ...) |
522 | 521 | (--> :continue)
|
523 | 522 | (<-- {:value "bar"})
|
524 | 523 | (<-- {:status ["done"]}))
|
525 | 524 |
|
526 | 525 | (testing "stepped-in-to functions are not instrumented"
|
527 |
| - ;; Test that stepped-in-to functions are not instrumented - that is, calling |
528 |
| - ;; misc/as-sym directly now should not invoke the debugger, even though we |
529 |
| - ;; were stepping through its code in the test above. |
530 |
| - (--> :eval "(misc/as-sym \"bar\")") |
| 526 | + ;; Test that stepped-in-to functions are not instrumented - that is, |
| 527 | + ;; calling test-fn/as-sym directly now should not invoke the debugger, |
| 528 | + ;; even though we were stepping through its code in the test above. |
| 529 | + (--> :eval "(test-fn/as-sym \"bar\")") |
531 | 530 | (<-- {:value "bar"})
|
532 | 531 | (<-- {:status ["done"]}))
|
533 | 532 |
|
534 | 533 | (testing ":in command acts as :next on non-function"
|
535 | 534 | (--> :eval "#dbg (let [s \"blah\"]
|
536 | 535 | s
|
537 |
| - (misc/as-sym s))") |
| 536 | + (test-fn/as-sym s))") |
538 | 537 | (<-- {:debug-value "\"blah\"" :coor [2]})
|
539 | 538 | ;; try to step in to `s`, make sure nothing blows up
|
540 | 539 | (--> :in)
|
|
0 commit comments