diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/map-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/map-tests.el b/test/lisp/emacs-lisp/map-tests.el index 07e85cc5391..15b0655040c 100644 --- a/test/lisp/emacs-lisp/map-tests.el +++ b/test/lisp/emacs-lisp/map-tests.el | |||
| @@ -63,6 +63,11 @@ Evaluate BODY for each created map. | |||
| 63 | (with-maps-do map | 63 | (with-maps-do map |
| 64 | (should (= 5 (map-elt map 7 5))))) | 64 | (should (= 5 (map-elt map 7 5))))) |
| 65 | 65 | ||
| 66 | (ert-deftest test-map-elt-testfn () | ||
| 67 | (let ((map (list (cons "a" 1) (cons "b" 2)))) | ||
| 68 | (should-not (map-elt map "a")) | ||
| 69 | (should (map-elt map "a" nil 'equal)))) | ||
| 70 | |||
| 66 | (ert-deftest test-map-elt-with-nil-value () | 71 | (ert-deftest test-map-elt-with-nil-value () |
| 67 | (should (null (map-elt '((a . 1) | 72 | (should (null (map-elt '((a . 1) |
| 68 | (b)) | 73 | (b)) |
| @@ -94,6 +99,13 @@ Evaluate BODY for each created map. | |||
| 94 | (should (eq (map-elt alist 2) | 99 | (should (eq (map-elt alist 2) |
| 95 | 'b)))) | 100 | 'b)))) |
| 96 | 101 | ||
| 102 | (ert-deftest test-map-put-testfn-alist () | ||
| 103 | (let ((alist (list (cons "a" 1) (cons "b" 2)))) | ||
| 104 | (map-put alist "a" 3 'equal) | ||
| 105 | (should-not (cddr alist)) | ||
| 106 | (map-put alist "a" 9) | ||
| 107 | (should (cddr alist)))) | ||
| 108 | |||
| 97 | (ert-deftest test-map-put-return-value () | 109 | (ert-deftest test-map-put-return-value () |
| 98 | (let ((ht (make-hash-table))) | 110 | (let ((ht (make-hash-table))) |
| 99 | (should (eq (map-put ht 'a 'hello) 'hello)))) | 111 | (should (eq (map-put ht 'a 'hello) 'hello)))) |