bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#66042: 30.0.50; ERT test fails while trying to indent pretty-print


From: Protesilaos Stavrou
Subject: bug#66042: 30.0.50; ERT test fails while trying to indent pretty-print
Date: Mon, 18 Sep 2023 07:54:58 +0300

Hello Stefan, Mauro,

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sun, 17 Sep 2023 04:47:29 -0700

> [... 20 lines elided]

> I can't reproduce this on current master.  Evaluating the above two
> forms in emacs -Q and then saying

> [... 23 lines elided]

> Which version of Emacs are you running?
>
> Can you reproduce it in emacs -Q?

Yes, I can reproduce it with 'emacs -Q' on Emacs trunk.  I tried it just
now with the following code.  See attached screenshot.

    (require 'ert)

    (defun ert--pp-with-indentation-and-newline (object)
      "Pretty-print OBJECT, indenting it to the current column of point.
    Ensures a final newline is inserted."
      (let ((begin (point))
            (pp-escape-newlines t)
            (print-escape-control-characters t))
        (pp object (current-buffer))
        (unless (bolp) (insert "\n"))
        (save-excursion
          (goto-char begin)
          (indent-sexp)
          )))

    (ert-deftest my-kill-backward-test-close-parens ()
      "aaa)))"
      (test-case "aaa)))" 7 "aaa"))

    (defun test-case (text pos expected)
      (with-temp-buffer
        (insert text)
        (goto-char pos)
        (backward-kill-word 1)
        (should (string-equal (buffer-string) expected))))

If I restart Emacs, comment out (indent-sexp), then evaluate the buffer,
and then the ERT test, everything works as expected.  There is no
'wholenump' error.

All the best,
Prot

-- 
Protesilaos Stavrou
https://protesilaos.com

Attachment: 2023-09-18_07:50:02_1274x1056.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]