Skip to content

Commit

Permalink
Fix ~ symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
mk committed Dec 26, 2022
1 parent 5cf3982 commit 4d06d81
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/nextjournal/clerk/viewer.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@
;; https://clojurians.slack.com/archives/C03S1KBA2/p1667334982789659

#?(:clj (defn roundtrippable? [x]
(= x (-> x str read-string))))
(try
(= x (-> x str read-string))
(catch Exception _e false))))

#?(:clj
(defmethod print-method clojure.lang.Keyword [o w]
Expand Down
4 changes: 3 additions & 1 deletion test/nextjournal/clerk/viewer_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@
(is (= "#viewer-eval (symbol \"with spaces\")"
(pr-str (symbol "with spaces"))))
(is (= "#viewer-eval (symbol \"with ns\" \"and spaces\")"
(pr-str (symbol "with ns" "and spaces")))))
(pr-str (symbol "with ns" "and spaces"))))
(is (= "#viewer-eval (symbol \"~\")"
(pr-str (symbol "~")))))

(testing "splicing reader conditional prints normally (issue #338)"
(is (= "?@" (pr-str (symbol "?@"))))))
Expand Down

0 comments on commit 4d06d81

Please sign in to comment.