diff options
| author | Stefan Kangas | 2021-09-26 13:18:29 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2021-09-26 13:21:53 +0200 |
| commit | f4ea15907aeb020b80d021a8d6bf212bcde08ab9 (patch) | |
| tree | 87c741f9cc2ebd51a558e463d57b96ff3722e430 /lisp | |
| parent | ce6cee4ca3db5da25989b630668c03fe5d4c614c (diff) | |
| download | emacs-f4ea15907aeb020b80d021a8d6bf212bcde08ab9.tar.gz 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." | |||
| 540 | (ert--explain-equal-rec a b))) | 540 | (ert--explain-equal-rec a b))) |
| 541 | (put 'equal 'ert-explainer 'ert--explain-equal) | 541 | (put 'equal 'ert-explainer 'ert--explain-equal) |
| 542 | 542 | ||
| 543 | (defun ert--explain-string-equal (a b) | ||
| 544 | "Explainer function for `string-equal'." | ||
| 545 | ;; Convert if they are symbols. | ||
| 546 | (let ((as (if (symbolp a) (symbol-name a) a)) | ||
| 547 | (bs (if (symbolp b) (symbol-name b) b))) | ||
| 548 | (ert--explain-equal-rec as bs))) | ||
| 549 | (put 'string-equal 'ert-explainer 'ert--explain-string-equal) | ||
| 550 | |||
| 543 | (defun ert--significant-plist-keys (plist) | 551 | (defun ert--significant-plist-keys (plist) |
| 544 | "Return the keys of PLIST that have non-null values, in order." | 552 | "Return the keys of PLIST that have non-null values, in order." |
| 545 | (cl-assert (zerop (mod (length plist) 2)) t) | 553 | (cl-assert (zerop (mod (length plist) 2)) t) |