Skip to content

Commit 23b5dde

Browse files
committed
CLJS-2881: cl-format character directive with \space fails
1 parent 4b6da5e commit 23b5dde

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/cljs/cljs/pprint.cljs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
(defn- print-char [c]
3333
(-write *out* (condp = c
3434
\backspace "\\backspace"
35+
\space "\\space"
3536
\tab "\\tab"
3637
\newline "\\newline"
3738
\formfeed "\\formfeed"

src/test/cljs/cljs/pprint_test.cljs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
(:require-macros
1212
[cljs.pprint-test :refer [simple-tests code-block]])
1313
(:require
14-
[cljs.test :as t :refer-macros [deftest is]]
14+
[cljs.test :as t :refer-macros [deftest is are]]
1515
[cljs.pprint :refer [pprint cl-format get-pretty-writer prn print-table
1616
*print-pprint-dispatch* simple-dispatch
1717
*print-right-margin* *print-miser-width*
@@ -1087,3 +1087,14 @@ Usage: *hello*
10871087
"
10881088
)
10891089

1090+
(deftest test-cljs-2881
1091+
(are [expected ch]
1092+
(= expected (with-out-str (cl-format true "~@c" ch)))
1093+
"\\newline" \newline
1094+
"\\space" \space
1095+
"\\tab" \tab
1096+
"\\backspace" \backspace
1097+
"\\return" \return
1098+
"\\formfeed" \formfeed
1099+
"\\\"" \"
1100+
"\\\\" \\))

0 commit comments

Comments
 (0)