diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-09-26 15:29:20 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-09-26 15:30:40 +0200 |
commit | b8b1d8dee7e30415b057b7a45f288fda3601274f (patch) | |
tree | 702451540dfc1612c29f646da644c05fb28cfac7 /lisp/emacs-lisp/ert.el | |
parent | 94af99b298381d7d8e08b6d76de00906c74d9421 (diff) | |
download | emacs-b8b1d8dee7e30415b057b7a45f288fda3601274f.tar.gz emacs-b8b1d8dee7e30415b057b7a45f288fda3601274f.tar.bz2 emacs-b8b1d8dee7e30415b057b7a45f288fda3601274f.zip |
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>.
Diffstat (limited to 'lisp/emacs-lisp/ert.el')
-rw-r--r-- | lisp/emacs-lisp/ert.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index e72321f90ff..72fe19461f7 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -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) |