File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 673
673
(print-meta obj)
674
674
(print-map "{" "}" obj))
675
675
676
+ (defmethod simple-dispatch basilisp.lang.interfaces/IRecord
677
+ [obj]
678
+ (print-meta obj)
679
+ (let [prefix (str "#" (.-__qualname__ (python/type obj)) "{")]
680
+ (print-map prefix "}" (into {} obj))))
681
+
682
+ (prefer-method simple-dispatch basilisp.lang.interfaces/IRecord basilisp.lang.interfaces/IPersistentMap)
683
+
676
684
(defmethod simple-dispatch python/dict
677
685
[obj]
678
686
(print-map "#py {" "}" (.items obj)))
Original file line number Diff line number Diff line change 216
216
(deftest pprint-var-test
217
217
(is (= "#'basilisp.core/map\n" (with-out-str (pprint/pprint #'map)))))
218
218
219
+ (defrecord Point [x y z])
220
+
221
+ (deftest pprint-record-test
222
+ (is (= "#Point{:x 1 :y 2 :z 3}\n"
223
+ (with-out-str
224
+ (binding [pprint/*print-sort-keys* true]
225
+ (pprint/pprint (->Point 1 2 3)))))))
226
+
219
227
(deftest pprint-ideref-test
220
228
(testing "delay"
221
229
(let [d (delay :delayed)]
You can’t perform that action at this time.
0 commit comments