aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorNicolas Petton2017-07-07 21:21:55 +0200
committerNicolas Petton2017-07-11 10:07:16 +0200
commit0bece6c6815cc59e181817a2765a4ea752f34f56 (patch)
tree856363b2defed20c97a25c29a7739bce9a6bd9cb /test/src
parent689c5c20d1174e95be50e674d05632545eb4b9c5 (diff)
downloademacs-0bece6c6815cc59e181817a2765a4ea752f34f56.tar.gz
emacs-0bece6c6815cc59e181817a2765a4ea752f34f56.zip
Add an optional testfn parameter to assoc
* src/fns.c (assoc): New optional testfn parameter used for comparison when provided. * test/src/fns-tests.el (test-assoc-testfn): Add tests for the new 'testfn' parameter. * src/buffer.c: * src/coding.c: * src/dbusbind.c: * src/font.c: * src/fontset.c: * src/gfilenotify.c: * src/image.c: * src/keymap.c: * src/process.c: * src/w32fns.c: * src/w32font.c: * src/w32notify.c: * src/w32term.c: * src/xdisp.c: * src/xfont.c: Add a third argument to Fassoc calls. * etc/NEWS: * doc/lispref/lists.texi: Document the new 'testfn' parameter.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 2e463455f0c..e294859226c 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -373,6 +373,12 @@
373 (should-error (assoc 3 d1) :type 'wrong-type-argument) 373 (should-error (assoc 3 d1) :type 'wrong-type-argument)
374 (should-error (assoc 3 d2) :type 'wrong-type-argument))) 374 (should-error (assoc 3 d2) :type 'wrong-type-argument)))
375 375
376(ert-deftest test-assoc-testfn ()
377 (let ((alist '(("a" . 1) ("b" . 2))))
378 (should-not (assoc "a" alist #'ignore))
379 (should (eq (assoc "b" alist #'string-equal) (cadr alist)))
380 (should-not (assoc "b" alist #'eq))))
381
376(ert-deftest test-cycle-rassq () 382(ert-deftest test-cycle-rassq ()
377 (let ((c1 (cyc1 '(0 . 1))) 383 (let ((c1 (cyc1 '(0 . 1)))
378 (c2 (cyc2 '(0 . 1) '(0 . 2))) 384 (c2 (cyc2 '(0 . 1) '(0 . 2)))