From e40ace1ab97790920dc605fca03d775a5d75215e Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Thu, 9 May 2024 22:18:54 -0700 Subject: [PATCH] update import clojure.test/cljs.test vars Signed-off-by: Sean Corfield --- CHANGELOG.md | 3 +++ src/expectations/clojure/test.cljc | 41 ++++++++++++++++-------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d464389..e869830 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/expectations/clojure/test.cljc b/src/expectations/clojure/test.cljc index 7b77a54..dd85408 100644 --- a/src/expectations/clojure/test.cljc +++ b/src/expectations/clojure/test.cljc @@ -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))