feat: Honor *print-namespace-maps* in pprint (#1387)
We can now use the dynamic var `*print-namespace-maps*` to control how maps with namespaced keys are printed using `pprint`. Fixes: #1381
This commit is contained in:
parent
9fba927ec8
commit
77768cec67
3 changed files with 13 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ A preview of the next release can be installed from
|
|||
## Unreleased
|
||||
|
||||
- Add single argument read method support to PipedInputStream proxy ([@retrogradeorbit](https://github.com/retrogradeorbit))
|
||||
- feat: Honor `*print-namespace-maps*` in pprint ([@ghoseb](https://github.com/ghoseb))
|
||||
|
||||
## 0.10.163 (2022-09-24)
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@
|
|||
pprint/*print-miser-width* @print-miser-width
|
||||
*print-meta* @sci/print-meta
|
||||
*print-readably* @sci/print-readably
|
||||
*print-length* @sci/print-length]
|
||||
*print-length* @sci/print-length
|
||||
*print-namespace-maps* @sci/print-namespace-maps]
|
||||
(pprint/pprint s writer))))
|
||||
|
||||
(defn cl-format
|
||||
|
|
|
|||
|
|
@ -10,3 +10,13 @@
|
|||
(deftest print-length-test
|
||||
(is (= "(0 1 2 3 4 5 6 7 8 9 ...)"
|
||||
(bb "-e" "(set! *print-length* 10) (clojure.pprint/pprint (range 20))"))))
|
||||
|
||||
(deftest print-namespaced-map-test
|
||||
(test/testing
|
||||
"Testing disabling of printing namespace maps..."
|
||||
(is (= "{:a/x 1, :a/y 2, :a/z {:b/x 10, :b/y 20}}"
|
||||
(bb "-e" "(binding [*print-namespace-maps* false] (clojure.pprint/pprint {:a/x 1 :a/y 2 :a/z {:b/x 10 :b/y 20}}))"))))
|
||||
(test/testing
|
||||
"Testing manually enabling printing namespace maps..."
|
||||
(is (= "#:a{:x 1, :y 2, :z #:b{:x 10, :y 20}}"
|
||||
(bb "-e" "(binding [*print-namespace-maps* true] (clojure.pprint/pprint {:a/x 1 :a/y 2 :a/z {:b/x 10 :b/y 20}}))")))))
|
||||
|
|
|
|||
Loading…
Reference in a new issue