summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2018-01-23 18:50:23 -0500
committerNoam Postavsky <npostavs@gmail.com>2018-01-28 10:43:01 -0500
commit36c8128e740ce91af10769bef46a21a72dafc56c (patch)
tree19a2dd3106c0e65b2e12cb4f7e542f6d9e9d2aa1 /test
parent69a30e8b87fac5888daa26c63663351570e3d533 (diff)
downloademacs-36c8128e740ce91af10769bef46a21a72dafc56c.tar.gz
Fix round tripping of read->print for symbols with strange quotes
Since 2017-07-22 "Signal error for symbol names with strange quotes (Bug#2967)", symbol names beginning with certain quote characters require an escaping backslash. However, the corresponding change for printing missed, so that (eq (read (prin1-to-string SYM)) SYM) does not give `t' for such symbols. * src/character.c (confusable_symbol_character_p): New function, extracted from test `read1'. * src/lread.c (read1): Use it. * src/print.c (print_object): Use it to print a backslash for symbols starting with characters that `read1' requires to be escaped. * test/src/print-tests.el (print-read-roundtrip): New test. * etc/NEWS.26: * etc/NEWS: Clarify the announcement for the earlier reader change (Bug#30217).
Diffstat (limited to 'test')
-rw-r--r--test/src/print-tests.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/src/print-tests.el b/test/src/print-tests.el
index 46368c69ada..01e65028bc7 100644
--- a/test/src/print-tests.el
+++ b/test/src/print-tests.el
@@ -58,5 +58,9 @@
(buffer-string))
"--------\n"))))
+(ert-deftest print-read-roundtrip ()
+ (let ((sym '\’bar))
+ (should (eq (read (prin1-to-string sym)) sym))))
+
(provide 'print-tests)
;;; print-tests.el ends here