|
60 | 60 | (let [node (no-warn (analyze ns-env '(def x)))]
|
61 | 61 | (is (= :def (:op node)))
|
62 | 62 | (is (s/valid? ::a/node node)))
|
63 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(def x 1))))) |
64 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(def x (fn [])))))) |
65 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(def x (fn [y] y))))))) |
| 63 | + (is (s/valid? ::a/node (analyze ns-env '(def x 1)))) |
| 64 | + (is (s/valid? ::a/node (analyze ns-env '(def x (fn []))))) |
| 65 | + (is (s/valid? ::a/node (analyze ns-env '(def x (fn [y] y)))))) |
66 | 66 |
|
67 | 67 | (deftest test-fn
|
68 | 68 | (let [node (no-warn (analyze ns-env '(fn [])))]
|
69 | 69 | (is (= :fn (:op node)))
|
70 | 70 | (is (s/valid? ::a/node node)))
|
71 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(fn [] 1))))) |
72 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(fn [x]))))) |
73 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(fn [x] 1)))))) |
| 71 | + (is (s/valid? ::a/node (analyze ns-env '(fn [] 1)))) |
| 72 | + (is (s/valid? ::a/node (analyze ns-env '(fn [x])))) |
| 73 | + (is (s/valid? ::a/node (analyze ns-env '(fn [x] 1))))) |
74 | 74 |
|
75 | 75 | (deftest test-defn
|
76 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(defn x []))))) |
77 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(defn x [] 1))))) |
78 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(defn x [y] y)))))) |
| 76 | + (is (s/valid? ::a/node (analyze ns-env '(defn x [])))) |
| 77 | + (is (s/valid? ::a/node (analyze ns-env '(defn x [] 1)))) |
| 78 | + (is (s/valid? ::a/node (analyze ns-env '(defn x [y] y))))) |
79 | 79 |
|
80 | 80 | (deftest test-new
|
81 | 81 | (let [node (no-warn (analyze ns-env '(new String)))]
|
82 | 82 | (is (= :new (:op node)))
|
83 | 83 | (is (s/valid? ::a/node node)))
|
84 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(new js/String))))) |
| 84 | + (is (s/valid? ::a/node (analyze ns-env '(new js/String)))) |
85 | 85 | (is (s/valid? ::a/node (no-warn (analyze ns-env '(String.)))))
|
86 |
| - (is (s/valid? ::a/node (no-warn (analyze ns-env '(js/String.)))))) |
| 86 | + (is (s/valid? ::a/node (analyze ns-env '(js/String.))))) |
| 87 | + |
| 88 | +(deftest test-defrecord |
| 89 | + (let [node (no-warn (analyze ns-env '(defrecord A []))) |
| 90 | + body (:body node)] |
| 91 | + (is (= :defrecord (->> body :statements first :ret :op))) |
| 92 | + (is (s/valid? ::a/node node)))) |
| 93 | + |
| 94 | +; TODO: #js |
| 95 | +;(deftest test-js-object |
| 96 | +; ) |
87 | 97 |
|
88 | 98 | (comment
|
89 | 99 |
|
|
0 commit comments