File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 213213#?(:clj
214214 (defmethod emit-constant Double [x] (emits x))
215215 :cljs
216- (defmethod emit-constant js /Number [x] (emits x )))
216+ (defmethod emit-constant js /Number [x] (emits " ( " x " ) " )))
217217
218218#?(:clj
219219 (defmethod emit-constant BigDecimal [x] (emits (.doubleValue ^BigDecimal x))))
Original file line number Diff line number Diff line change 7171 (cljs/compile-str st " (+ 1 1)"
7272 (fn [{:keys [error value]}]
7373 (is (nil? error))
74- (is (= " (1 + 1 );\n " value))
74+ (is (= " ((1) + (1) );\n " value))
7575 (inc! l)))
7676 (cljs/compile-str st " (fn [])" nil
7777 {:context :expr }
8383 {:context :expr }
8484 (fn [{:keys [error value]}]
8585 (is (nil? error))
86- (is (= " (cljs.core.truth_(cljs.core.first)?1:2 )" value))
86+ (is (= " (cljs.core.truth_(cljs.core.first)?(1):(2) )" value))
8787 (inc! l)))
8888 (cljs/compile-str st " (.toString \" a\" )" nil
8989 {:context :expr }
9595 {:context :expr }
9696 (fn [{:keys [error value]}]
9797 (is (nil? error))
98- (is (string/index-of value " cljs.user.foo.call(null,1,2 )" ))
98+ (is (string/index-of value " cljs.user.foo.call(null,(1),(2) )" ))
9999 (inc! l)))
100100 (cljs/compile-str st " (do (defn foo [a b] (+ a b)) (foo 1 2))" nil
101101 {:context :expr
102102 :static-fns true }
103103 (fn [{:keys [error value]}]
104104 (is (nil? error))
105- (is (string/index-of value " cljs.user.foo(1,2 )" ))
105+ (is (string/index-of value " cljs.user.foo((1),(2) )" ))
106106 (inc! l))))))
107107
108108(deftest test-eval-str
197197 (is (nil? error))
198198 (inc! l))))))
199199
200+ (deftest test-CLJS-1330
201+ (cljs/eval-str st
202+ " (.toString 1)"
203+ nil
204+ {:eval node-eval}
205+ (fn [{:keys [error value]}]
206+ (is (= " 1" value)))))
207+
200208#_(deftest test-eval-str-with-require
201209 (async done
202210 (let [l (latch 3 done)]
You can’t perform that action at this time.
0 commit comments