From: Stefan Kangas Date: Sun, 26 Sep 2021 11:18:29 +0000 (+0200) Subject: ert: Add basic explainer for string-equal X-Git-Tag: emacs-28.0.90~610 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f4ea15907aeb020b80d021a8d6bf212bcde08ab9;p=emacs.git ert: Add basic explainer for string-equal * lisp/emacs-lisp/ert.el (ert--explain-string-equal): Add basic explainer for 'string-equal' based on 'ert--explain-equal'. --- diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el index 6d867abd7a2..e72321f90ff 100644 --- a/lisp/emacs-lisp/ert.el +++ b/lisp/emacs-lisp/ert.el @@ -540,6 +540,14 @@ Returns nil if they are." (ert--explain-equal-rec a b))) (put 'equal 'ert-explainer 'ert--explain-equal) +(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))) +(put 'string-equal 'ert-explainer 'ert--explain-string-equal) + (defun ert--significant-plist-keys (plist) "Return the keys of PLIST that have non-null values, in order." (cl-assert (zerop (mod (length plist) 2)) t)