1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-27 10:54:40 +00:00

Add fast-path to ert--explain-string-equal

* lisp/emacs-lisp/ert.el (ert--explain-string-equal): Add fast-path to
avoid doing extra work.
Problem reported by Mattias Engdegård <mattiase@acm.org>.
This commit is contained in:
Stefan Kangas 2021-09-26 15:29:20 +02:00
parent 94af99b298
commit b8b1d8dee7

View File

@ -543,9 +543,11 @@ Returns nil if they are."
(defun ert--explain-string-equal (a b)
"Explainer function for `string-equal'."
;; Convert if they are symbols.
(let ((as (if (symbolp a) (symbol-name a) a))
(bs (if (symbolp b) (symbol-name b) b)))
(ert--explain-equal-rec as bs)))
(if (string-equal a b)
nil
(let ((as (if (symbolp a) (symbol-name a) a))
(bs (if (symbolp b) (symbol-name b) b)))
(ert--explain-equal-rec as bs))))
(put 'string-equal 'ert-explainer 'ert--explain-string-equal)
(defun ert--significant-plist-keys (plist)