Skip to content

Commit

Permalink
[babashka#420] Add support for clojure.core/find-var
Browse files Browse the repository at this point in the history
  • Loading branch information
RickMoynihan committed Sep 21, 2020
1 parent 2f3760e commit 9966e62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/sci/impl/namespaces.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,7 @@
'ex-message (copy-core-var ex-message)
'ex-cause (copy-core-var ex-cause)
'find-ns (with-meta sci-find-ns {:sci.impl/op :needs-ctx})
#?@(:clj 'find-var (copy-core-var find-var))
'first (copy-core-var first)
'float? (copy-core-var float?)
'floats (copy-core-var floats)
Expand Down
3 changes: 3 additions & 0 deletions test/sci/namespaces_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
(is (eval* "(defn bar []) (ns-unmap *ns* 'bar) (nil? (resolve 'bar))"))
(is (eval* "(defn- baz []) (ns-unmap *ns* 'baz) (nil? (resolve 'baz))")))

#?(:clj (deftest find-var-test
(is (= #'clojure.core/map (eval* "(find-var 'clojure.core/map)")))))

(deftest find-ns-test
(is (true? (eval* "(ns foo) (some? (find-ns 'foo))")))
(is (nil? (eval* "(find-ns 'foo)"))))
Expand Down

0 comments on commit 9966e62

Please sign in to comment.