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 673673 (print-meta obj)
674674 (print-map "{" "}" obj))
675675
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+
676684(defmethod simple-dispatch python/dict
677685 [obj]
678686 (print-map "#py {" "}" (.items obj)))
Original file line number Diff line number Diff line change 216216(deftest pprint-var-test
217217 (is (= "#'basilisp.core/map\n" (with-out-str (pprint/pprint #'map)))))
218218
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+
219227(deftest pprint-ideref-test
220228 (testing "delay"
221229 (let [d (delay :delayed)]
You can’t perform that action at this time.
0 commit comments