diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b6d8c11..d5926105 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/src/babashka/impl/pprint.clj b/src/babashka/impl/pprint.clj index ffd31e28..0c0e815f 100644 --- a/src/babashka/impl/pprint.clj +++ b/src/babashka/impl/pprint.clj @@ -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 diff --git a/test/babashka/pprint_test.clj b/test/babashka/pprint_test.clj index 4679db46..d21c3386 100644 --- a/test/babashka/pprint_test.clj +++ b/test/babashka/pprint_test.clj @@ -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}}))")))))