Skip to content

Commit 0214e88

Browse files
committed
Fix CLJS tests
1 parent a4fa364 commit 0214e88

File tree

2 files changed

+42
-43
lines changed

2 files changed

+42
-43
lines changed

bb.edn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
:task (exec 'lambdaisland.deep-diff2.runner/run-tests)}
1111
npm-ws (when-not (fs/exists? "node_modules/ws")
1212
(shell "npm install ws"))
13-
test:clj {:doc "Run kaocha tests"
14-
:depends [npm-ws]
15-
:task (apply clojure "-M:dev:test -m kaocha.runner" *command-line-args*)}}}
13+
test:kaocha {:doc "Run kaocha tests"
14+
:depends [npm-ws]
15+
:task (apply clojure "-M:dev:test -m kaocha.runner" *command-line-args*)}}}

src/lambdaisland/deep_diff2/puget/printer.cljc

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -296,46 +296,45 @@
296296
"Map of print handlers for Java/JavaScript types. This supports syntax for regular
297297
expressions, dates, UUIDs, and futures."
298298
#?(:clj
299-
{java.lang.Class
300-
(fn class-handler
301-
[printer value]
302-
(format-unknown printer value "Class" (get-type-name value)))
303-
304-
java.util.concurrent.Future
305-
(fn future-handler
306-
[printer value]
307-
(let [doc (if (future-done? promise)
308-
(format-doc printer @value)
309-
(color/document printer :nil "pending"))]
310-
(format-unknown printer value "Future" doc)))
311-
312-
java.util.UUID
313-
(tagged-handler 'uuid str)
314-
315-
java.util.Date
316-
(tagged-handler
317-
'inst
318-
#(-> (java.text.SimpleDateFormat. inst-pattern)
319-
(doto (.setTimeZone (java.util.TimeZone/getTimeZone "GMT")))
320-
(.format ^java.util.Date %)))
321-
322-
#?@(:bb []
323-
:clj
324-
[java.util.GregorianCalendar
325-
(tagged-handler
326-
'inst
327-
#(let [formatted (format "%1$tFT%1$tT.%1$tL%1$tz" %)
328-
offset-minutes (- (.length formatted) 2)]
329-
(str (subs formatted 0 offset-minutes)
330-
":"
331-
(subs formatted offset-minutes))))])
332-
333-
java.sql.Timestamp
334-
(tagged-handler
335-
'inst
336-
(fn [ts]
337-
(str (.format ^SimpleDateFormat (utc-timestamp-format) ts)
338-
(format ".%09d-00:00" (.getNanos ^Timestamp ts)))))}
299+
(->
300+
{java.lang.Class
301+
(fn class-handler
302+
[printer value]
303+
(format-unknown printer value "Class" (get-type-name value)))
304+
305+
java.util.concurrent.Future
306+
(fn future-handler
307+
[printer value]
308+
(let [doc (if (future-done? promise)
309+
(format-doc printer @value)
310+
(color/document printer :nil "pending"))]
311+
(format-unknown printer value "Future" doc)))
312+
313+
java.util.UUID
314+
(tagged-handler 'uuid str)
315+
316+
java.util.Date
317+
(tagged-handler
318+
'inst
319+
#(-> (java.text.SimpleDateFormat. inst-pattern)
320+
(doto (.setTimeZone (java.util.TimeZone/getTimeZone "GMT")))
321+
(.format ^java.util.Date %)))
322+
323+
java.sql.Timestamp
324+
(tagged-handler
325+
'inst
326+
(fn [ts]
327+
(str (.format ^SimpleDateFormat (utc-timestamp-format) ts)
328+
(format ".%09d-00:00" (.getNanos ^Timestamp ts)))))}
329+
#?(:bb identity
330+
:clj (assoc java.util.GregorianCalendar
331+
(tagged-handler
332+
'inst
333+
#(let [formatted (format "%1$tFT%1$tT.%1$tL%1$tz" %)
334+
offset-minutes (- (.length formatted) 2)]
335+
(str (subs formatted 0 offset-minutes)
336+
":"
337+
(subs formatted offset-minutes)))))))
339338

340339
:cljs
341340
{inst?

0 commit comments

Comments
 (0)