Subject: Re: bug#13543: 24.2; [PATCH] (ert) "wrong-type-argument characterp" when assert fail on large (>28 bit) numbers

From: Glenn Morris <[email-masked]>
Date: Mon, 04 Feb 2013 02:49:05 -0500

Oleksandr Gavenko wrote:

> 'should' from lisp/emacs-lisp/ert.el fail to create character from
> number, for example evaluate one of these expressions:
>
>   (should (equal #x1000000 1))
>   (should (equal 1 -1))

I can see some usefulness to printing the character form for something
like

(should (equal ?a ?b))

so I installed this change:

***************
*** 568,574 ****
  (defun ert--explain-format-atom (x)
    "Format the atom X for `ert--explain-equal'."
    (cl-typecase x
!     (fixnum (list x (format "#x%x" x) (format "?%c" x)))
      (t x)))
  
  (defun ert--explain-equal-rec (a b)
--- 568,575 ----
  (defun ert--explain-format-atom (x)
    "Format the atom X for `ert--explain-equal'."
    (cl-typecase x
!     (character (list x (format "#x%x" x) (format "?%c" x)))
!     (fixnum (list x (format "#x%x" x)))
      (t x)))
  
  (defun ert--explain-equal-rec (a b)

 > Another problem from (format "?%c" x) is performance penalty when "x"
 > is rare character code (font library intensively scan for missing
 > character glyph among all system available fonts causing 5 second
 > delay and 100% hard disk usage).

This seems like a general issue rather than an ERT one.

> I recommend remove formatting to character as amount of problems are
> larger then amount of benefits.