File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 5252
5353(defmacro defn-dynj
5454 " Declares `name` as a dynamic injection point, to be bound to an
55- implementation/value later via [[binding]], and adds a default
56- implementation. Typically you would throw a helpful exception in the
57- body."
55+ implementation/value later via [[binding]], and adds a default implementation.
56+ Typically you would throw a helpful exception in `body`."
5857 [name params & body]
5958 (let [[docstring params body]
6059 (if (string? params)
6160 [params (first body) (rest body)]
6261 [nil params body])]
6362
64- `(do (defn ~name [~@params] ~body )
63+ `(do (defn ~name [~@params] ~@ body )
6564 (alter-meta! (var ~name) assoc
6665 :dynamic true
6766 ::dynj true
Original file line number Diff line number Diff line change 2525 (sut/bound-fn* (fn [v]
2626 (foo v))))]
2727 (t/is (= 8 (f 4 )))))
28+
29+ (sut/defn-dynj bar [arg]
30+ (* 3 arg))
31+
32+ (t/deftest defn-dynj-default-implementation-test
33+ (t/is (= 9 (bar 3 ))))
You can’t perform that action at this time.
0 commit comments