From 265c36c95341a570487fa0162dcf7bfb0492608e Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Fri, 29 Sep 2023 20:05:15 -0700 Subject: [PATCH] restore cljs compat --- src/expectations/clojure/test.cljc | 13 +++++-------- test/expectations/clojure/test_test.cljc | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/expectations/clojure/test.cljc b/src/expectations/clojure/test.cljc index 517b306..11e75e0 100644 --- a/src/expectations/clojure/test.cljc +++ b/src/expectations/clojure/test.cljc @@ -198,9 +198,11 @@ #?(:clj (class? e#) :cljs false) ; maybe figure this out later [(instance? e# a#) ; (expect klazz object) - (str a# " (" (class a#) ") is not an instance of " e# "\n") + (str a# + #?(:clj (str " (" (class a#) ")")) + " is not an instance of " e# "\n") (list '~'instance? '~e '~a) - (class a#)] + #?(:clj (class a#))] :else [(= e# a#) (when (and (string? e#) (string? a#) (not= e# a#)) @@ -405,12 +407,7 @@ `(t/is (~'=? ~e ~a) ~msg')) :cljs (if (= 'js/Error e) `(t/is (~'thrown? ~e ~a) ~msg') - `(t/is (~'=? ~e ~a) ~msg'))) - - ;; (isa? (type e) - ;; #?(:clj java.util.regex.Pattern - ;; :cljs (type #"regex"))) - ;; `(t/is (re-find ~e ~a) ~msg') + `(t/is (~'instance? ~e ~a) ~msg'))) :else `(t/is (~'=? ~e ~a) ~msg'))))) diff --git a/test/expectations/clojure/test_test.cljc b/test/expectations/clojure/test_test.cljc index 58d4f58..7aa51d3 100644 --- a/test/expectations/clojure/test_test.cljc +++ b/test/expectations/clojure/test_test.cljc @@ -112,7 +112,7 @@ (* 13 4))) (is-not' (sut/expect :expectations.clojure.test-spec/small-value (* 13 40)) - (not (=? :expectations.clojure.test-spec/small-value 520))))) + (not (s/valid? :expectations.clojure.test-spec/small-value 520))))) (deftest collection-test (is (sut/expect {:foo 1} (in {:foo 1 :cat 4}))) @@ -217,7 +217,7 @@ #"(?is)(str \"abc\" \"efg\").*matches: \"abc\"")) :cljs (deftest string-compare-failure-test (is-not' (sut/expect "abcdef" (str "abc" "efg")) - ["abcefg"] + (not= "abcdef" "abcefg") #"(?is)(str \"abc\" \"efg\").*matches: \"abc\""))) (deftest issue-19-regex-test