-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use orchard.query for apropos and tests
- Loading branch information
1 parent
201bced
commit cf9f3a0
Showing
6 changed files
with
166 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(ns cider.nrepl.middleware.util.coerce | ||
"Coercion utilities for coercing bencoded maps.") | ||
|
||
(defn- update-some | ||
[m k & args] | ||
(if (get m k) | ||
(apply update m k args) | ||
m)) | ||
|
||
(defn ns-query | ||
"Poke and prod at a bencoded ns-query until it is in the form that orchard | ||
expects." | ||
[ns-query] | ||
(-> ns-query | ||
(update-some :exactly | ||
#(map (fn [ns-string] | ||
(if-let [ns (find-ns (symbol ns-string))] | ||
ns | ||
(throw (ex-info "Namespace not found" | ||
{::id :namespace-not-found | ||
:namespace-string ns-string})))) | ||
%)) | ||
(update :project? some?) | ||
(update :load-project-ns? some?) | ||
(update :has-tests? some?) | ||
(update-some :include-regexps #(map re-pattern %)) | ||
(update-some :exclude-regexps #(map re-pattern %)))) | ||
|
||
(defn var-query | ||
[var-query] | ||
(-> var-query | ||
(update :ns-query ns-query) | ||
(update-some :exactly #(map (comp find-ns symbol) %)) | ||
(update :test? some?) | ||
(update :private? some?) | ||
(update-some :include-meta-key #(map keyword %)) | ||
(update-some :exclude-meta-key #(map keyword %)) | ||
(update-some :search re-pattern) | ||
(update-some :search-property keyword) | ||
(dissoc :manipulate-vars))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If original query didn't have both
:search
and:case-sensitive?
, it was producing a malformedsearch
param:"(?i:null)"
.