Skip to content

Commit

Permalink
Add refactor-nrepl.find-symbol-test
Browse files Browse the repository at this point in the history
Tries reproducing https://github.com/clojure-emacs/clj-refactor.el/issues/485

`find-symbol` seemed to lack test coverage anyway.
  • Loading branch information
vemv committed Aug 29, 2021
1 parent 392d417 commit afb4a9c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/refactor_nrepl/find_symbol_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
(ns refactor-nrepl.find-symbol-test
(:require
[clojure.test :refer [deftest is]]
[refactor-nrepl.unreadable-files :refer [ignore-errors-str]]
[refactor-nrepl.find.find-symbol :as sut])
(:import
(java.io File)))

(def from-file-path
(-> "testproject/src/com/move/ns_to_be_moved.clj" File. .getAbsolutePath))

(deftest works
(let [found (sut/find-symbol {:file from-file-path
:ns "com.move.ns-to-be-moved"
:line 11
:column 7
:name "fn-to-be-moved"
:ignore-errors ignore-errors-str
:dir "testproject/src"})]
(is (seq found)
(pr-str found))
(is (= 4 (->> found (map :file) distinct count))
"Finds different files with references to the queried symbol")))
3 changes: 3 additions & 0 deletions testproject/src/com/move/ns_to_be_moved.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
(ns com.move.ns-to-be-moved)

;; Tries reproducing https://github.com/clojure-emacs/clj-refactor.el/issues/485
(set! *warn-on-reflection* true)

(def var-to-be-moved)
(def ^:private private-var-to-be-moved)

Expand Down

0 comments on commit afb4a9c

Please sign in to comment.