|
5 | 5 | (when-var-exists ancestors |
6 | 6 |
|
7 | 7 | ; Some classes for testing ancestors by type inheritance |
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)) |
| 8 | + (def AncestorT #?(:cljs js/Object :lpy python/object :phel ArrayIterator :default Object)) |
| 9 | + (def ChildT #?(:cljs :default :lpy basilisp.lang.set/PersistentSet :phel RecursiveArrayIterator :default clojure.lang.PersistentHashSet)) |
10 | 10 |
|
11 | 11 | ; Some custom types for testing ancestors by type inheritance |
12 | 12 | (defprotocol TestAncestorsProtocol) |
|
73 | 73 |
|
74 | 74 | (testing "returns ancestors by type inheritance when tag is a class" |
75 | 75 | #?(:cljs "cljs doesn't report ancestors by type inheritance yet (CLJS-3464)" |
| 76 | + :phel (is (contains? (ancestors ChildT) AncestorT)) |
76 | 77 | :clj (is (contains? (ancestors ChildT) AncestorT)))) |
77 | 78 |
|
78 | 79 | #?(:bb "bb doesn't report ancestors by type inheritance for custom types" |
79 | 80 | :cljs "cljs doesn't report ancestors by type inheritance yet (CLJS-3464)" |
80 | 81 | :default (testing "returns ancestors by type inheritance when tag is a custom type" |
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 | + (is (contains? (ancestors TestAncestorsType) #?(:lpy (:interface TestAncestorsProtocol) :phel TestAncestorsProtocol :default clojure.core_test.ancestors.TestAncestorsProtocol))) |
| 83 | + (is (contains? (ancestors TestAncestorsRecord) #?(:lpy (:interface TestAncestorsProtocol) :phel TestAncestorsProtocol :default clojure.core_test.ancestors.TestAncestorsProtocol))) |
| 84 | + (is (contains? (ancestors TestAncestorsRecord) #?(:lpy basilisp.lang.interfaces/IAssociative :phel Phel.Lang.Collections.Map.PersistentMapInterface :default clojure.lang.Associative))) |
84 | 85 | (is (nil? (ancestors TestAncestorsProtocol))))) |
85 | 86 |
|
86 | 87 | (testing "does not throw on invalid tag" |
|
142 | 143 | :cljs "cljs doesn't report ancestors by type inheritance yet (CLJS-3464)" |
143 | 144 | :default (testing "returns ancestors by type inheritance when tag is a custom type, whether the tag is in h or not" |
144 | 145 | (are [h tag] (let [actual-ancestors (ancestors h tag)] |
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)))) |
| 146 | + (and (contains? actual-ancestors #?(:lpy (:interface TestAncestorsProtocol) :phel TestAncestorsProtocol :default clojure.core_test.ancestors.TestAncestorsProtocol)) |
| 147 | + (contains? actual-ancestors #?(:lpy basilisp.lang.interfaces/IAssociative :phel Phel.Lang.Collections.Map.PersistentMapInterface :default clojure.lang.Associative)))) |
147 | 148 | ; tag in h |
148 | 149 | datatypes TestAncestorsRecord |
149 | 150 | ; tag not in h |
|
0 commit comments