all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleksandr Gavenko <gavenkoa@gmail.com>
To: 13543@debbugs.gnu.org
Subject: bug#13543: 24.2; [PATCH] (ert) "wrong-type-argument characterp" when assert fail on large (>28 bit) numbers
Date: Thu, 24 Jan 2013 22:32:35 +0200	[thread overview]
Message-ID: <878v7i1fvg.fsf@gavenkoa.example.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]

In GNU Emacs 24.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-09-09 on trouble, modified by Debian

'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))

Problem come from "?%c" in:

  (defun ert--explain-format-atom (x)
    "Format the atom X for `ert--explain-equal'."
    (typecase x
      (fixnum (list x (format "#x%x" x) (format "?%c" x)))
      (t x)))

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).

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

I discover this issue when start write tests for low level binary parsing
library (ASN.1).


[-- Attachment #2: ert--explain-format-atom.patch --]
[-- Type: text/plain, Size: 958 bytes --]

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-12-19 13:01:16 +0000
+++ lisp/ChangeLog	2013-01-24 20:29:45 +0000
@@ -1,3 +1,10 @@
+2013-01-24  Oleksandr Gavenko  <gavenkoa@gmail.com>
+
+	* ert.el (ert--explain-format-atom): Delete formating into
+	character due to performance issue on attempts to find font glyph
+	for rare used character and impossibility handle negative or large
+	numbers.
+
 2012-12-19  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/tramp-sh.el (tramp-sh-handle-file-acl): Delete empty lines

=== modified file 'lisp/emacs-lisp/ert.el'
--- lisp/emacs-lisp/ert.el	2012-11-23 03:26:09 +0000
+++ lisp/emacs-lisp/ert.el	2013-01-24 20:21:48 +0000
@@ -568,7 +568,7 @@
 (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)))
+    (fixnum (list x (format "#x%x" x)))
     (t x)))
 
 (defun ert--explain-equal-rec (a b)


[-- Attachment #3: Type: text/plain, Size: 19 bytes --]


-- 
Best regards!

             reply	other threads:[~2013-01-24 20:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 20:32 Oleksandr Gavenko [this message]
2013-02-04  7:49 ` bug#13543: 24.2; [PATCH] (ert) "wrong-type-argument characterp" when assert fail on large (>28 bit) numbers Glenn Morris
2013-02-04 15:33   ` Oleksandr Gavenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878v7i1fvg.fsf@gavenkoa.example.com \
    --to=gavenkoa@gmail.com \
    --cc=13543@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.