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

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

bug#30219: 27.0.50; (should (equal ...)) bug for string equality


From: Lars Ingebrigtsen
Subject: bug#30219: 27.0.50; (should (equal ...)) bug for string equality
Date: Wed, 09 Oct 2019 23:29:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Philipp <p.stephani2@gmail.com> writes:

> Define the following ERT test:
>
> (ert-deftest foo ()
>   (should (equal "a\xFF" "a\u00FF")))
>
> Then run M-x ert.  The test triggers an assertion.  This is because ERT
> incorrectly assumes that two arrays are equal if their lengths and
> elements are equal, but that's not the case when comparing unibyte and
> multibyte strings.

I tried putting

(ert-deftest foo ()
  (should (equal "a\xFF" "a\u00FF")))

into one of the test files and I got

1 unexpected results:
   FAILED  foo

So I'm not able to reproduce this bug.  But the code in question hasn't
changed since this was reported, so I'm not sure why I can't reproduce
it.

Does anybody else see this?

      ((pred arrayp)
       (if (/= (length a) (length b))
           `(arrays-of-different-length ,(length a) ,(length b)
                                        ,a ,b
                                        ,@(unless (char-table-p a)
                                            `(first-mismatch-at
                                              ,(cl-mismatch a b :test 'equal))))
         (cl-loop for i from 0
                  for ai across a
                  for bi across b
                  for xi = (ert--explain-equal-rec ai bi)
                  do (when xi (cl-return `(array-elt ,i ,xi)))
                  finally (cl-assert (equal a b) t))))



-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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