File tree 1 file changed +9
-9
lines changed
1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change 1
1
(ns active.clojure.dynj-test
2
- (:require [active.clojure.dynj :as sut ]
2
+ (:require [active.clojure.dynj :as dynj ]
3
3
[clojure.test :as t]))
4
4
5
- (sut /declare-dynj foo " Foo" [bar])
5
+ (dynj /declare-dynj foo " Foo" [bar])
6
6
7
7
(t/deftest declare-dynj-test
8
8
; ; (t/is (:dynamic (meta #'foo)))
11
11
(t/deftest binding-test
12
12
(t/is (thrown? Exception (foo 4 )))
13
13
14
- (sut /binding [foo (fn [x] (* x 2 ))]
14
+ (dynj /binding [foo (fn [x] (* x 2 ))]
15
15
(t/is (= 8 (foo 4 )))))
16
16
17
17
(t/deftest threading-test
18
18
; ; threads 'inherit' current bindings
19
- (sut /binding [foo (fn [x] (* x 2 ))]
19
+ (dynj /binding [foo (fn [x] (* x 2 ))]
20
20
(t/is (= 8 @(future (foo 4 ))))))
21
21
22
22
(t/deftest bound-fn-test
23
23
; ; bind a function to current bindings
24
- (let [f (sut /binding [foo (fn [x] (* x 2 ))]
25
- (sut /bound-fn* (fn [v]
26
- (foo v))))]
24
+ (let [f (dynj /binding [foo (fn [x] (* x 2 ))]
25
+ (dynj /bound-fn* (fn [v]
26
+ (foo v))))]
27
27
(t/is (= 8 (f 4 )))))
28
28
29
29
(t/deftest with-bindings*-test
30
30
(t/is
31
31
(= 7
32
- (sut /with-bindings*
32
+ (dynj /with-bindings*
33
33
; ; just "foo" doesn't work here; Var is expected
34
34
{#'foo (fn [x] (+ x 4 ))}
35
35
; ; expects a thunk
36
36
(fn [] (foo 3 ))))))
37
37
38
- (sut /defn-dynj bar [arg]
38
+ (dynj /defn-dynj bar [arg]
39
39
(* 3 arg))
40
40
41
41
(t/deftest defn-dynj-default-implementation-test
You can’t perform that action at this time.
0 commit comments