Skip to content

Commit

Permalink
Include specs in var-meta
Browse files Browse the repository at this point in the history
Wasn't threaded before so the value was computed and thrown away.
  • Loading branch information
dan sutton authored and bbatsov committed Sep 4, 2019
1 parent 5d15e26 commit 1b966fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/orchard/meta.clj
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@
maybe-add-file
maybe-add-url
(update :ns ns-name))]
(maybe-add-spec v meta-map)
(maybe-add-see-also v meta-map)))))
(->> meta-map
(maybe-add-spec v)
(maybe-add-see-also v))))))

(defn meta+
"Return special form or var's meta."
Expand Down
5 changes: 5 additions & 0 deletions test/orchard/meta_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
(deftest var-meta-test
;; Test files can't be found on the class path.
(is (:file (m/var-meta #'m/var-meta)))
(testing "Includes spec information"
(is (or (contains? (m/var-meta (resolve 'let)) :spec)
(nil? (resolve 'clojure.spec.alpha/spec)))))
(testing "Includes see-also information from clojure docs"
(is (contains? (m/var-meta (resolve 'clojure.set/union)) :see-also)))
(is (re-find #"string\.clj"
(:file (#'m/maybe-add-file
{:ns (find-ns 'clojure.string)}))))
Expand Down

0 comments on commit 1b966fa

Please sign in to comment.