File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 3
3
[clojure.java.io :as io]
4
4
[refactor-nrepl.config :as config])
5
5
(:import
6
+ (clojure.lang IFn)
6
7
(java.util.regex Pattern)))
7
8
8
9
(defn- libspec-allowlist* []
20
21
entry)))
21
22
(into (:libspec-whitelist config/*config*)))))
22
23
23
- (def ^:private ^:dynamic *libspec-allowlist* nil )
24
+ (def ^:private ^:dynamic ^IFn *libspec-allowlist* nil )
24
25
25
26
(defn with-memoized-libspec-allowlist* [f]
26
27
(binding [*libspec-allowlist* (memoize libspec-allowlist*)]
32
33
33
34
Uses a memoized version if available."
34
35
[]
35
- (or *libspec-allowlist*
36
+ (or ( some-> *libspec-allowlist* .invoke)
36
37
(libspec-allowlist* )))
37
38
38
39
(defmacro with-memoized-libspec-allowlist
Original file line number Diff line number Diff line change 4
4
[refactor-nrepl.ns.libspec-allowlist :as sut]
5
5
[refactor-nrepl.ns.prune-dependencies :as prune-dependencies]))
6
6
7
- (deftest libspec-allowlist
7
+ (deftest libspec-allowlist-test
8
8
(testing " Takes into account refactor-nrepls own config, and .clj-kondo/config files alike,
9
9
merging their results"
10
10
(is (= [; ; From refactor-nrepl's default config:
@@ -29,4 +29,9 @@ effecively parsing its config into well-formed regexes"
29
29
'sample.unused.namespaceB false
30
30
'more.unused.namespaces true
31
31
'more.unused.namespacessss true
32
- 'more.unused.namespac false ))))
32
+ 'more.unused.namespac false ))
33
+
34
+ (testing " Always returns a sequence, memoized or not"
35
+ (is (seq (sut/with-memoized-libspec-allowlist
36
+ (sut/libspec-allowlist ))))
37
+ (is (seq (sut/libspec-allowlist ))))))
You can’t perform that action at this time.
0 commit comments