File tree Expand file tree Collapse file tree 2 files changed +15
-18
lines changed
test/darkleaf/di/tutorial Expand file tree Collapse file tree 2 files changed +15
-18
lines changed Original file line number Diff line number Diff line change 807807 (p/dependencies factory))
808808 (build [_ deps]
809809 (let [obj (p/build factory deps)]
810- (built-cb key deps obj)
810+ (built-cb key obj)
811811 obj))
812812 (demolish [_ obj]
813813 (p/demolish factory obj)
Original file line number Diff line number Diff line change 1717 :c )
1818
1919(t/deftest log
20- (let [logs (atom [])
21- built! (fn [key deps obj]
22- (swap! logs conj [:built key deps obj]))
23- demolished! (fn [key obj]
24- (swap! logs conj [:demolished key obj]))
25- [a b c
26- :as system] (di/start [`a `b `c]
27- (di/log built! demolished!))]
28- (di/stop system)
29- (t/is (= [[:built `a {} a]
30- [:built `b {`a a} b]
31- [:built `c {`b b} c]
32- [:built ::di/implicit-root {`a a `b b `c c} [a b c]]
33- [:demolished ::di/implicit-root [a b c]]
34- [:demolished `c c]
35- [:demolished `b b]
36- [:demolished `a a]]
20+ (let [logs (atom [])
21+ built! (fn [key obj]
22+ (swap! logs conj [:built key (pr-str obj)]))
23+ demolished! (fn [key obj]
24+ (swap! logs conj [:demolished key (pr-str obj)]))]
25+ (with-open [root (di/start `c (di/log built! demolished!))])
26+ (t/is (= [[:built `a " :a" ]
27+ [:built `b
28+ " #darkleaf.di.core/service #'darkleaf.di.tutorial.x-log-test/b" ]
29+ [:built `c " :c" ]
30+ [:demolished `c " :c" ]
31+ [:demolished `b
32+ " #darkleaf.di.core/service #'darkleaf.di.tutorial.x-log-test/b" ]
33+ [:demolished `a " :a" ]]
3734 @logs))))
You can’t perform that action at this time.
0 commit comments