emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5510515: Improve error data when passing a wrong ty


From: Philipp Stephani
Subject: [Emacs-diffs] master 5510515: Improve error data when passing a wrong type to 'sort' (Bug#34104)
Date: Sat, 19 Jan 2019 18:04:32 -0500 (EST)

branch: master
commit 551051596fe51d6e232315eeda8a0a79eb43bfdf
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>

    Improve error data when passing a wrong type to 'sort' (Bug#34104)
    
    * src/fns.c (Fsort): Use 'list-or-vector-p' for error message.
    (syms_of_fns): Define 'list-or-vector-p'.
    
    * test/src/fns-tests.el (fns-tests-sort): Extend unit test.
---
 src/fns.c             | 3 ++-
 test/src/fns-tests.el | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/fns.c b/src/fns.c
index 1ac6032..3452114 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2084,7 +2084,7 @@ the second.  */)
   else if (VECTORP (seq))
     sort_vector (seq, predicate);
   else if (!NILP (seq))
-    wrong_type_argument (Qsequencep, seq);
+    wrong_type_argument (Qlist_or_vector_p, seq);
   return seq;
 }
 
@@ -5358,6 +5358,7 @@ Used by `featurep' and `require', and altered by 
`provide'.  */);
   DEFSYM (Qsubfeatures, "subfeatures");
   DEFSYM (Qfuncall, "funcall");
   DEFSYM (Qplistp, "plistp");
+  DEFSYM (Qlist_or_vector_p, "list-or-vector-p");
 
 #ifdef HAVE_LANGINFO_CODESET
   DEFSYM (Qcodeset, "codeset");
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index 3d1a8b3..d6cc99e 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -161,7 +161,10 @@
             '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff"))
            (lambda (x y) (< (car x) (car y))))
           [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee")
-           (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])))
+           (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))
+  ;; Bug#34104
+  (should (equal (should-error (sort "cba" #'<) :type 'wrong-type-argument)
+                 '(wrong-type-argument list-or-vector-p "cba"))))
 
 (ert-deftest fns-tests-collate-sort ()
   (skip-unless (fns-tests--collate-enabled-p))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]