Skip to content

Commit d48a165

Browse files
committed
fix CLJS and native test failures for .getName and use-does-not-bring-constructor
1 parent 1926f98 commit d48a165

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/sci/defrecords_and_deftype_test.cljc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,13 @@
464464
(testing "class? returns true for resolved types"
465465
(is (true? (tu/eval* "(deftype Foo [x]) (class? (resolve 'Foo))" {})))
466466
(is (true? (tu/eval* "(defrecord Bar [x]) (class? (resolve 'Bar))" {})))))
467-
(testing ".getName returns fully qualified name, like Class"
468-
(is (= "user.Foo" (tu/eval* "(deftype Foo [x]) (.getName (resolve 'Foo))" {:classes {:allow :all}})))
469-
(is (= "user.Bar" (tu/eval* "(defrecord Bar [x]) (.getName (resolve 'Bar))" {:classes {:allow :all}}))))
470467
#?(:clj
471-
(testing ".getName works even with ^Class type hint"
472-
(is (= "user.Foo" (tu/eval* "(deftype Foo [x]) (let [^java.lang.Class c (resolve 'Foo)] (.getName c))"
473-
{:classes {:allow :all 'java.lang.Class {:class java.lang.Class}}}))))))
468+
(let [opts {:classes {:allow :all 'java.lang.Class {:class java.lang.Class}}}]
469+
(testing ".getName returns fully qualified name, like Class"
470+
(is (= "user.Foo" (sci/eval-string "(deftype Foo [x]) (.getName (resolve 'Foo))" opts)))
471+
(is (= "user.Bar" (sci/eval-string "(defrecord Bar [x]) (.getName (resolve 'Bar))" opts))))
472+
(testing ".getName works even with ^Class type hint"
473+
(is (= "user.Foo" (sci/eval-string "(deftype Foo [x]) (let [^java.lang.Class c (resolve 'Foo)] (.getName c))" opts)))))))
474474

475475
(deftest deftype-macroexpand-constructor-visible-test
476476
(testing "macroexpand of deftype contains a (defn ->Foo ...) form"
@@ -534,7 +534,7 @@
534534
(deftest use-does-not-bring-constructor-test
535535
(testing "deftype constructor requires :import, not just :use"
536536
(is (thrown-with-msg? #?(:clj Exception :cljs js/Error)
537-
#"Unable to resolve classname"
537+
#"Unable to resolve"
538538
(tu/eval* "(ns foo) (deftype Bar [x])
539539
(ns baz (:use [foo]))
540540
(Bar. 1)" {}))))

0 commit comments

Comments
 (0)