File tree Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Expand file tree Collapse file tree 3 files changed +8
-6
lines changed Original file line number Diff line number Diff line change 37
37
ns-form )
38
38
39
39
(defn clean-ns [{:keys [path relative-path]}]
40
- {:pre [(seq path) (string? path) ( core/source-file? path) ]}
40
+ {:pre [(seq path) (string? path)]}
41
41
; ; Try first the absolute, then the relative path
42
42
(let [path (first (filter #(some-> % io/file .exists) [path relative-path]))]
43
+ (assert (core/source-file? path))
43
44
; ; Prefix notation not supported in cljs.
44
45
; ; We also turn it off for cljc for reasons of symmetry
45
46
(config/with-config {:prefix-rewriting (if (or (core/cljs-file? path)
Original file line number Diff line number Diff line change 156
156
(form-is? form :import ) (pprint-import-form form)
157
157
:else (pprint form))))
158
158
forms)))
159
- (.replaceAll " \r " " " )
159
+ (str/replace " \r " " " )
160
160
fmt/reformat-string
161
- (.replaceAll (Pattern/quote " #? @" ) " #?@" ))))
161
+ (str/replace (Pattern/quote " #? @" ) " #?@" ))))
Original file line number Diff line number Diff line change 3
3
[refactor-nrepl.config :as config]
4
4
[refactor-nrepl.core :as core]
5
5
[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])
7
8
(:import java.io.File))
8
9
9
10
(defn- absolute-path [^String path]
49
50
50
51
(def ns-using-dollar (clean-msg " test/resources/ns_using_dollar.clj" ))
51
52
52
- (def ns1-relative-path {:path " I do not exist"
53
+ (def ns1-relative-path {:path " I do not exist.clj "
53
54
:relative-path " test/resources/ns1.clj" })
54
55
55
56
(deftest combines-requires
59
60
60
61
(deftest meta-preserved
61
62
(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\"
63
64
:doc \" test ns with meta\" }" ))))
64
65
65
66
(deftest rewrites-use-to-require
You can’t perform that action at this time.
0 commit comments