|
5 | 5 | (when-var-exists ancestors |
6 | 6 |
|
7 | 7 | ; Some classes for testing ancestors by type inheritance |
8 | | - (def AncestorT #?(:cljs js/Object :default Object)) |
9 | | - (def ChildT #?(:cljs :default :default clojure.lang.PersistentHashSet)) |
| 8 | + (def AncestorT #?(:cljs js/Object :lpy python/object :default Object)) |
| 9 | + (def ChildT #?(:cljs :default :lpy basilisp.lang.set/PersistentSet :default clojure.lang.PersistentHashSet)) |
10 | 10 |
|
11 | 11 | ; Some custom types for testing ancestors by type inheritance |
12 | 12 | (defprotocol TestAncestorsProtocol) |
|
29 | 29 | (doseq [[tag parent] global-hierarchy] |
30 | 30 | (underive tag parent))) |
31 | 31 |
|
32 | | - (defn with-global-hierarchy [tests] |
| 32 | + ;; Basilisp does not support clojure.test style fixtures right now |
| 33 | + ;; https://github.com/basilisp-lang/basilisp/issues/1306 |
| 34 | + (defn with-global-hierarchy [#?@(:lpy [] :default [tests])] |
33 | 35 | (register-global-hierarchy) |
34 | | - (tests) |
| 36 | + #?(:lpy (yield) :default (tests)) |
35 | 37 | (unregister-global-hierarchy)) |
36 | 38 |
|
37 | 39 | (use-fixtures :once with-global-hierarchy) |
|
76 | 78 | #?(:bb "bb doesn't report ancestors by type inheritance for custom types" |
77 | 79 | :cljs "cljs doesn't report ancestors by type inheritance yet (CLJS-3464)" |
78 | 80 | :default (testing "returns ancestors by type inheritance when tag is a custom type" |
79 | | - (is (contains? (ancestors TestAncestorsType) clojure.core_test.ancestors.TestAncestorsProtocol)) |
80 | | - (is (contains? (ancestors TestAncestorsRecord) clojure.core_test.ancestors.TestAncestorsProtocol)) |
81 | | - (is (contains? (ancestors TestAncestorsRecord) clojure.lang.Associative)) |
| 81 | + (is (contains? (ancestors TestAncestorsType) #?(:lpy (:interface TestAncestorsProtocol) :default clojure.core_test.ancestors.TestAncestorsProtocol))) |
| 82 | + (is (contains? (ancestors TestAncestorsRecord) #?(:lpy (:interface TestAncestorsProtocol) :default clojure.core_test.ancestors.TestAncestorsProtocol))) |
| 83 | + (is (contains? (ancestors TestAncestorsRecord) #?(:lpy basilisp.lang.interfaces/IAssociative :default clojure.lang.Associative))) |
82 | 84 | (is (nil? (ancestors TestAncestorsProtocol))))) |
83 | 85 |
|
84 | 86 | (testing "does not throw on invalid tag" |
|
140 | 142 | :cljs "cljs doesn't report ancestors by type inheritance yet (CLJS-3464)" |
141 | 143 | :default (testing "returns ancestors by type inheritance when tag is a custom type, whether the tag is in h or not" |
142 | 144 | (are [h tag] (let [actual-ancestors (ancestors h tag)] |
143 | | - (and (contains? actual-ancestors clojure.core_test.ancestors.TestAncestorsProtocol) |
144 | | - (contains? actual-ancestors clojure.lang.Associative))) |
| 145 | + (and (contains? actual-ancestors #?(:lpy (:interface TestAncestorsProtocol) :default clojure.core_test.ancestors.TestAncestorsProtocol)) |
| 146 | + (contains? actual-ancestors #?(:lpy basilisp.lang.interfaces/IAssociative :default clojure.lang.Associative)))) |
145 | 147 | ; tag in h |
146 | 148 | datatypes TestAncestorsRecord |
147 | 149 | ; tag not in h |
|
0 commit comments