mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Fix ert ability to peek inside structures when comparing unequal values
* lisp/emacs-lisp/ert.el (ert--explain-equal-rec): Treat records as arrays (bug#40562). Also add support for cl-structs.
This commit is contained in:
parent
21c580566e
commit
82893e9e8e
1 changed files with 8 additions and 1 deletions
|
|
@ -515,7 +515,14 @@ Returns nil if they are."
|
||||||
`(cdr ,cdr-x)
|
`(cdr ,cdr-x)
|
||||||
(cl-assert (equal a b) t)
|
(cl-assert (equal a b) t)
|
||||||
nil))))))))
|
nil))))))))
|
||||||
((pred arrayp)
|
((pred cl-struct-p)
|
||||||
|
(cl-loop for slot in (cl-struct-slot-info (type-of a))
|
||||||
|
for ai across a
|
||||||
|
for bi across b
|
||||||
|
for xf = (ert--explain-equal-rec ai bi)
|
||||||
|
do (when xf (cl-return `(struct-field ,(car slot) ,xf)))
|
||||||
|
finally (cl-assert (equal a b) t)))
|
||||||
|
((or (pred arrayp) (pred recordp))
|
||||||
;; For mixed unibyte/multibyte string comparisons, make both multibyte.
|
;; For mixed unibyte/multibyte string comparisons, make both multibyte.
|
||||||
(when (and (stringp a)
|
(when (and (stringp a)
|
||||||
(xor (multibyte-string-p a) (multibyte-string-p b)))
|
(xor (multibyte-string-p a) (multibyte-string-p b)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue