From f4ea15907aeb020b80d021a8d6bf212bcde08ab9 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 26 Sep 2021 13:18:29 +0200 Subject: [PATCH] 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'. --- lisp/emacs-lisp/ert.el | 8 ++++++++ 1 file changed, 8 insertions(+) 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) -- 2.39.2