Skip to content

Commit c49f976

Browse files
committed
wip
1 parent 2d2195d commit c49f976

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

src/darkleaf/di/core.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@
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)

test/darkleaf/di/tutorial/x_log_test.clj

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@
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))))

0 commit comments

Comments
 (0)