Skip to content

Commit d56ff99

Browse files
committed
Address test failure, fix some reflection warnings.
1 parent 916b554 commit d56ff99

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/refactor_nrepl/ns/clean_ns.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@
3737
ns-form)
3838

3939
(defn clean-ns [{:keys [path relative-path]}]
40-
{:pre [(seq path) (string? path) (core/source-file? path)]}
40+
{:pre [(seq path) (string? path)]}
4141
;; Try first the absolute, then the relative path
4242
(let [path (first (filter #(some-> % io/file .exists) [path relative-path]))]
43+
(assert (core/source-file? path))
4344
;; Prefix notation not supported in cljs.
4445
;; We also turn it off for cljc for reasons of symmetry
4546
(config/with-config {:prefix-rewriting (if (or (core/cljs-file? path)

src/refactor_nrepl/ns/pprint.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,6 @@
156156
(form-is? form :import) (pprint-import-form form)
157157
:else (pprint form))))
158158
forms)))
159-
(.replaceAll "\r" "")
159+
(str/replace "\r" "")
160160
fmt/reformat-string
161-
(.replaceAll (Pattern/quote "#? @") "#?@"))))
161+
(str/replace (Pattern/quote "#? @") "#?@"))))

test/refactor_nrepl/ns/clean_ns_test.clj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
[refactor-nrepl.config :as config]
44
[refactor-nrepl.core :as core]
55
[refactor-nrepl.ns.clean-ns :refer [clean-ns]]
6-
[refactor-nrepl.ns.pprint :refer [pprint-ns]])
6+
[refactor-nrepl.ns.pprint :refer [pprint-ns]]
7+
[clojure.string :as str])
78
(:import java.io.File))
89

910
(defn- absolute-path [^String path]
@@ -49,7 +50,7 @@
4950

5051
(def ns-using-dollar (clean-msg "test/resources/ns_using_dollar.clj"))
5152

52-
(def ns1-relative-path {:path "I do not exist"
53+
(def ns1-relative-path {:path "I do not exist.clj"
5354
:relative-path "test/resources/ns1.clj"})
5455

5556
(deftest combines-requires
@@ -59,7 +60,7 @@
5960

6061
(deftest meta-preserved
6162
(let [cleaned (pprint-ns (clean-ns ns2-meta))]
62-
(is (.contains cleaned "^{:author \"Trurl and Klapaucius\"
63+
(is (str/includes? cleaned "^{:author \"Trurl and Klapaucius\"
6364
:doc \"test ns with meta\"}"))))
6465

6566
(deftest rewrites-use-to-require

0 commit comments

Comments
 (0)