Skip to content

Commit

Permalink
update import clojure.test/cljs.test vars
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Corfield <[email protected]>
  • Loading branch information
seancorfield committed May 10, 2024
1 parent d76fa82 commit e40ace1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

Only accretive/fixative changes will be made from now on.

* 2.1.next in progress
* Expose `run-test` and `run-test-var` from `clojure.test` (Clojure 1.11).

* 2.1.201 --2024-05-07
* Address [#35](https://github.com/clojure-expectations/clojure-test/issues/35) by treating any symbol starting with `expect` as an Expectations macro for the 2-argument form.
* Address [#33](https://github.com/clojure-expectations/clojure-test/issues/33) by expanding the README introduction.
Expand Down
41 changes: 22 additions & 19 deletions src/expectations/clojure/test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -550,26 +550,29 @@
"Intern the specified symbol from `clojure.test` as a symbol in
`expectations.clojure.test` with the same value and metadata."
[f]
(let [tf (symbol #?(:clj "clojure.test"
:cljs "cljs.test")
(name f))
v (#?(:clj resolve
:cljs planck.core/find-var)
tf)
m (meta v)]
(#?(:clj intern
:cljs planck.core/intern)
'expectations.clojure.test
(with-meta f
(update m
:doc
str
(str #?(:clj "\n\nImported from clojure.test."
:cljs "\n\nImported from cljs.test"))))
(deref v))))
(try
(let [tf (symbol #?(:clj "clojure.test"
:cljs "cljs.test")
(name f))
v (#?(:clj resolve
:cljs planck.core/find-var)
tf)
m (meta v)]
(#?(:clj intern
:cljs planck.core/intern)
'expectations.clojure.test
(with-meta f
(update m
:doc
str
(str #?(:clj "\n\nImported from clojure.test."
:cljs "\n\nImported from cljs.test"))))
(deref v)))
(catch #?(:clj Throwable
:cljs :default) _)))


;; bring over other useful clojure.test functions:
(doseq [f '[#?@(:clj [run-all-tests run-tests test-all-vars test-ns with-test])
test-var test-vars]]
(doseq [f '[#?@(:clj [run-all-tests run-tests run-test-var test-all-vars test-ns with-test])
run-test test-var test-vars]]
(from-clojure-test f))

0 comments on commit e40ace1

Please sign in to comment.