Skip to content

Commit

Permalink
restore cljs compat
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Sep 30, 2023
1 parent c9d2d6c commit 265c36c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
13 changes: 5 additions & 8 deletions src/expectations/clojure/test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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#))
Expand Down Expand Up @@ -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')))))
Expand Down
4 changes: 2 additions & 2 deletions test/expectations/clojure/test_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -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})))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 265c36c

Please sign in to comment.