File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -9635,7 +9635,9 @@ reduces them without incurring seq initialization"
9635
9635
(do
9636
9636
(-write writer " #js " )
9637
9637
(print-map
9638
- (map (fn [k] [(keyword k) (unchecked-get obj k)]) (js-keys obj))
9638
+ (map (fn [k]
9639
+ [(cond-> k (some? (re-matches #"[A-Za-z][\w\*\+\? !\- ']*" k)) keyword) (unchecked-get obj k)])
9640
+ (js-keys obj))
9639
9641
pr-writer writer opts))
9640
9642
9641
9643
(array? obj)
Original file line number Diff line number Diff line change 1413
1413
(is (contains? (ns-imports 'clojure.string) 'StringBuffer))
1414
1414
(is (= (find (ns-imports 'clojure.string) 'StringBuffer)
1415
1415
['StringBuffer goog.string.StringBuffer]))))
1416
+
1416
1417
(deftest test-cljs-2190
1417
1418
(binding [*print-namespace-maps* true ]
1418
1419
(testing " printing a javascript map with a slash on keyword"
1419
- (is (= " #js {: foo/bar 33}" (pr-str (doto (js-obj ) (gobject/set " foo/bar" 33 )))))
1420
- (is (= " #js {: foo/bar #:var{:quux 66}}" (pr-str (doto (js-obj ) (gobject/set " foo/bar" {:var/quux 66 }))))))))
1420
+ (is (= " #js {\" foo/bar\" 33}" (pr-str (doto (js-obj ) (gobject/set " foo/bar" 33 )))))
1421
+ (is (= " #js {\" foo/bar\" #:var{:quux 66}}" (pr-str (doto (js-obj ) (gobject/set " foo/bar" {:var/quux 66 }))))))))
1421
1422
1422
1423
(def ^:const true-2267 true )
1423
1424
(def ^:const false-2267 false )
1436
1437
(is (= :then (if zero-2267 :then :else )))
1437
1438
(is (= :then (if non-zero-2267 :then :else ))))
1438
1439
1440
+ (deftest test-cljs-2278
1441
+ (is (= " #js {:alpha 1, \" beta gamma\" 2, \" delta/epsilon\" 3}" (pr-str #js {" alpha" 1 " beta gamma" 2 " delta/epsilon" 3 })))
1442
+ (is (= " #js {\" :abc\" 1}" (pr-str #js {" :abc" 1 })))
1443
+ (is (= " #js {\" 0abc\" 1}" (pr-str #js {" 0abc" 1 })))
1444
+ (is (= " #js {:abc-def 1}" (pr-str #js {" abc-def" 1 })))
1445
+ (is (= " #js {:x*+?!-' 1}" (pr-str #js {" x*+?!-'" 1 }))))
1446
+
1439
1447
(comment
1440
1448
; ; ObjMap
1441
1449
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments