diff options
| author | Philipp Stephani | 2017-09-02 21:08:04 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-09-02 21:08:04 +0200 |
| commit | 71766a45f1edb02ec5107803a7f7a8e17809b093 (patch) | |
| tree | a2b5f8d72f6a6213646814fa0c6c8556617b23ea /test | |
| parent | dbe1e55dc4064e82813f6b84ee4297d8fc45b2fc (diff) | |
| download | emacs-71766a45f1edb02ec5107803a7f7a8e17809b093.tar.gz emacs-71766a45f1edb02ec5107803a7f7a8e17809b093.zip | |
Improve error messages for improper plists (Bug#27726)
* src/fns.c (Fplist_put, Flax_plist_get, Flax_plist_put)
(Fplist_member, syms_of_fns): Use ‘plistp’ as pseudo-predicate for
improper plists instead of ‘listp.’
* test/src/fns-tests.el (plist-get/odd-number-of-elements)
(lax-plist-get/odd-number-of-elements)
(plist-put/odd-number-of-elements)
(lax-plist-put/odd-number-of-elements)
(plist-member/improper-list): Add unit tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/src/fns-tests.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index e294859226c..73c6593caf7 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -547,4 +547,32 @@ | |||
| 547 | (should-error (nconc (cyc1 1) 'tail) :type 'circular-list) | 547 | (should-error (nconc (cyc1 1) 'tail) :type 'circular-list) |
| 548 | (should-error (nconc (cyc2 1 2) 'tail) :type 'circular-list)) | 548 | (should-error (nconc (cyc2 1 2) 'tail) :type 'circular-list)) |
| 549 | 549 | ||
| 550 | (ert-deftest plist-get/odd-number-of-elements () | ||
| 551 | "Test that ‘plist-get’ doesn’t signal an error on degenerate plists." | ||
| 552 | (should-not (plist-get '(:foo 1 :bar) :bar))) | ||
| 553 | |||
| 554 | (ert-deftest lax-plist-get/odd-number-of-elements () | ||
| 555 | "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." | ||
| 556 | (should (equal (should-error (lax-plist-get '(:foo 1 :bar) :bar) | ||
| 557 | :type 'wrong-type-argument) | ||
| 558 | '(wrong-type-argument plistp (:foo 1 :bar))))) | ||
| 559 | |||
| 560 | (ert-deftest plist-put/odd-number-of-elements () | ||
| 561 | "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." | ||
| 562 | (should (equal (should-error (plist-put '(:foo 1 :bar) :zot 2) | ||
| 563 | :type 'wrong-type-argument) | ||
| 564 | '(wrong-type-argument plistp (:foo 1 :bar))))) | ||
| 565 | |||
| 566 | (ert-deftest lax-plist-put/odd-number-of-elements () | ||
| 567 | "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." | ||
| 568 | (should (equal (should-error (lax-plist-put '(:foo 1 :bar) :zot 2) | ||
| 569 | :type 'wrong-type-argument) | ||
| 570 | '(wrong-type-argument plistp (:foo 1 :bar))))) | ||
| 571 | |||
| 572 | (ert-deftest plist-member/improper-list () | ||
| 573 | "Check for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27726." | ||
| 574 | (should (equal (should-error (plist-member '(:foo 1 . :bar) :qux) | ||
| 575 | :type 'wrong-type-argument) | ||
| 576 | '(wrong-type-argument plistp (:foo 1 . :bar))))) | ||
| 577 | |||
| 550 | (provide 'fns-tests) | 578 | (provide 'fns-tests) |