Skip to content

Commit ee4b295

Browse files
committed
Add refactor-nrepl.find-symbol-test
Tries reproducing https://github.com/clojure-emacs/clj-refactor.el/issues/485 `find-symbol` seemed to lack test coverage anyway.
1 parent 392d417 commit ee4b295

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
(ns refactor-nrepl.find-symbol-test
2+
(:require
3+
[clojure.test :refer [deftest is]]
4+
[refactor-nrepl.unreadable-files :refer [ignore-errors-str]]
5+
[refactor-nrepl.find.find-symbol :as sut])
6+
(:import
7+
(java.io File)))
8+
9+
(def from-file-path
10+
(-> "testproject/src/com/move/ns_to_be_moved.clj" File. .getAbsolutePath))
11+
12+
(deftest works
13+
(let [found (sut/find-symbol {:file from-file-path
14+
:ns "com.move.ns-to-be-moved"
15+
:line 11
16+
:column 7
17+
:name "fn-to-be-moved"
18+
:ignore-errors ignore-errors-str
19+
:dir "testproject/src"})]
20+
(is (seq found)
21+
(pr-str found))
22+
(is (= 4 (->> found (map :file) distinct count))
23+
"Finds different files with references to the queried symbol")))

testproject/src/com/example/one.clj

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77

88
(defn from-registry [k]
99
(k four/registry))
10+
11+
;; Tries reproducing https://github.com/clojure-emacs/clj-refactor.el/issues/485
12+
(set! *warn-on-reflection* true)

testproject/src/com/move/ns_to_be_moved.clj

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
(ns com.move.ns-to-be-moved)
22

3+
;; Tries reproducing https://github.com/clojure-emacs/clj-refactor.el/issues/485
4+
(set! *warn-on-reflection* true)
5+
36
(def var-to-be-moved)
47
(def ^:private private-var-to-be-moved)
58

0 commit comments

Comments
 (0)