diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-09-26 13:18:29 +0200 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-09-26 13:21:53 +0200 |
commit | f4ea15907aeb020b80d021a8d6bf212bcde08ab9 (patch) | |
tree | 87c741f9cc2ebd51a558e463d57b96ff3722e430 /lisp | |
parent | ce6cee4ca3db5da25989b630668c03fe5d4c614c (diff) | |
download | emacs-f4ea15907aeb020b80d021a8d6bf212bcde08ab9.tar.gz emacs-f4ea15907aeb020b80d021a8d6bf212bcde08ab9.tar.bz2 emacs-f4ea15907aeb020b80d021a8d6bf212bcde08ab9.zip |
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'.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/ert.el | 8 |
1 files changed, 8 insertions, 0 deletions
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) |