summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2023-06-17 18:05:33 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2023-06-17 18:05:33 -0400
commita9c962be961ae121c4202943879dcf28f3a8364a (patch)
treeef918d1e6c317c30c9924a9216b18fda77bc703d /test/lisp/emacs-lisp
parent017475a70ed51b69ebe41610e0dd1299bda1bfe3 (diff)
downloademacs-a9c962be961ae121c4202943879dcf28f3a8364a.tar.gz
emacs-a9c962be961ae121c4202943879dcf28f3a8364a.tar.bz2
emacs-a9c962be961ae121c4202943879dcf28f3a8364a.zip
pp-fill: Fix tests breakage
* lisp/emacs-lisp/pp.el (pp-to-string, pp-buffer, pp): Preserve old behavior of (almost always) returning a trailing newline. * test/lisp/emacs-lisp/pp-tests.el (pp-print-quote): Adjust tests, now that `pp-to-string` always returns a trailing newline, rather than only most of the time. * test/lisp/emacs-lisp/backtrace-tests.el (backtrace-tests--single-and-multi-line): Make the test less sensitive to the choice of what is "pretty".
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/backtrace-tests.el6
-rw-r--r--test/lisp/emacs-lisp/pp-tests.el4
2 files changed, 7 insertions, 3 deletions
diff --git a/test/lisp/emacs-lisp/backtrace-tests.el b/test/lisp/emacs-lisp/backtrace-tests.el
index 794488edae8..e5899446ee4 100644
--- a/test/lisp/emacs-lisp/backtrace-tests.el
+++ b/test/lisp/emacs-lisp/backtrace-tests.el
@@ -226,6 +226,9 @@
"Forms in backtrace frames can be on a single line or on multiple lines."
(ert-with-test-buffer (:name "single-multi-line")
(let* ((arg '(lambda (x) ; Quote this so it isn't made into a closure.
+ ;; Make the form long enough so `number' should not
+ ;; appear on the first line once pretty-printed.
+ (interactive (region-beginning))
(let ((number (1+ x)))
(+ x number))))
(header-string "Test header: ")
@@ -280,7 +283,8 @@ line contains the strings \"lambda\" and \"number\"."
;; Verify that the form is now back on one line,
;; and that point is at the same place.
(should (string= (backtrace-tests--get-substring
- (- (point) 6) (point)) "number"))
+ (- (point) 6) (point))
+ "number"))
(should-not (= (point) (pos-bol)))
(should (string= (backtrace-tests--get-substring
(pos-bol) (1+ (pos-eol)))
diff --git a/test/lisp/emacs-lisp/pp-tests.el b/test/lisp/emacs-lisp/pp-tests.el
index 72c7cb880d2..1b248e19a31 100644
--- a/test/lisp/emacs-lisp/pp-tests.el
+++ b/test/lisp/emacs-lisp/pp-tests.el
@@ -23,8 +23,8 @@
(require 'ert-x)
(ert-deftest pp-print-quote ()
- (should (string= (pp-to-string 'quote) "quote"))
- (should (string= (pp-to-string ''quote) "'quote"))
+ (should (string= (pp-to-string 'quote) "quote\n"))
+ (should (string= (pp-to-string ''quote) "'quote\n"))
(should (string= (pp-to-string '('a 'b)) "('a 'b)\n"))
(should (string= (pp-to-string '(''quote 'quote)) "(''quote 'quote)\n"))
(should (string= (pp-to-string '(quote)) "(quote)\n"))