Skip to content

Commit

Permalink
deep-contains?
Browse files Browse the repository at this point in the history
  • Loading branch information
darkleaf committed Oct 24, 2024
1 parent cfd3232 commit 9e2de74
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/darkleaf/di/cache_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@
(t/is (thrown? IllegalStateException
(di/start ::root (di/use-cache cache))))))

(defn- deep-contains? [coll x]
(->> coll
(tree-seq coll? seq)
(filter #(= x %))
(first)
(not= nil)))

(t/deftest not-recursive-test
(di/with-open [[_ cache] (di/start [::root ::di/cache]
{::root :root}
(di/collect-cache))]
(t/try-expr "must not be recrusive"
(prn-str cache))))

(t/is (not (deep-contains? @cache cache)))))

(defn- some+identical? [a b]
(and (some? a)
Expand Down

0 comments on commit 9e2de74

Please sign in to comment.