|
464 | 464 | (testing "class? returns true for resolved types" |
465 | 465 | (is (true? (tu/eval* "(deftype Foo [x]) (class? (resolve 'Foo))" {}))) |
466 | 466 | (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}})))) |
470 | 467 | #?(: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))))))) |
474 | 474 |
|
475 | 475 | (deftest deftype-macroexpand-constructor-visible-test |
476 | 476 | (testing "macroexpand of deftype contains a (defn ->Foo ...) form" |
|
534 | 534 | (deftest use-does-not-bring-constructor-test |
535 | 535 | (testing "deftype constructor requires :import, not just :use" |
536 | 536 | (is (thrown-with-msg? #?(:clj Exception :cljs js/Error) |
537 | | - #"Unable to resolve classname" |
| 537 | + #"Unable to resolve" |
538 | 538 | (tu/eval* "(ns foo) (deftype Bar [x]) |
539 | 539 | (ns baz (:use [foo])) |
540 | 540 | (Bar. 1)" {})))) |
|
0 commit comments