diff options
author | Noam Postavsky <npostavs@gmail.com> | 2018-04-14 01:02:25 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2018-04-26 07:37:48 -0400 |
commit | b8aa7ecf54c9b164a59f1b0e9f9fe90531dadd20 (patch) | |
tree | e1e627b8472a68eb859b578306490f2dc95b34bd /test/lisp/emacs-lisp | |
parent | a92e7b4ef6915e079a97e4e33e45b11508170cb1 (diff) | |
download | emacs-b8aa7ecf54c9b164a59f1b0e9f9fe90531dadd20.tar.gz emacs-b8aa7ecf54c9b164a59f1b0e9f9fe90531dadd20.tar.bz2 emacs-b8aa7ecf54c9b164a59f1b0e9f9fe90531dadd20.zip |
Fix cl-print for circular sublists (Bug#31146)
* lisp/emacs-lisp/cl-print.el (cl-print-object) <cons>: Push each
element of list being printed onto cl-print--currently-printing.
* test/lisp/emacs-lisp/cl-print-tests.el (cl-print-circle-2): New
test.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r-- | test/lisp/emacs-lisp/cl-print-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/cl-print-tests.el b/test/lisp/emacs-lisp/cl-print-tests.el index 660d5c80692..d986c4015d7 100644 --- a/test/lisp/emacs-lisp/cl-print-tests.el +++ b/test/lisp/emacs-lisp/cl-print-tests.el @@ -55,4 +55,14 @@ (let ((print-circle t)) (should (equal "(#1=(a . #1#) #1#)" (cl-prin1-to-string x)))))) +(ert-deftest cl-print-circle-2 () + ;; Bug#31146. + (let ((x '(0 . #1=(0 . #1#)))) + (let ((print-circle nil)) + (should (string-match "\\`(0 0 . #[0-9])\\'" + (cl-prin1-to-string x)))) + (let ((print-circle t)) + (should (equal "(0 . #1=(0 . #1#))" (cl-prin1-to-string x)))))) + + ;;; cl-print-tests.el ends here. |