From ec393caa67051d982607b531985bb5c2a0ab5def Mon Sep 17 00:00:00 2001 From: Mikhail Kuzmin Date: Fri, 11 Oct 2024 22:52:32 +0400 Subject: [PATCH] wip2 --- test/darkleaf/di/tutorial/z_memoize_test.clj | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/darkleaf/di/tutorial/z_memoize_test.clj b/test/darkleaf/di/tutorial/z_memoize_test.clj index eee64886..e71dd9f7 100644 --- a/test/darkleaf/di/tutorial/z_memoize_test.clj +++ b/test/darkleaf/di/tutorial/z_memoize_test.clj @@ -34,3 +34,24 @@ (with-open [local (di/start `root (di/use-cache cache))] (t/is (identical? global-system @local))))) + +#_ +;; or should we use external atom to also cache in local system? +(t/deftest ok + (let [cache (atom {}) ;; (di/make-cache) + global-system (di/start `root + (di/collect-cache cache))] + + (with-open [local (di/start `root + (di/use-cache cache) + (di/collect-cache cache))] + (t/is (identical? @global-system @local))))) +#_ +(t/deftest ok + (let [cache (atom {}) ;; (di/make-cache) + global-system (di/start `root + (di/use-cache cache))] + + (with-open [local (di/start `root + (di/use-cache cache))] + (t/is (identical? @global-system @local)))))