emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/compat 3e65059af7 3/7: Add func-arity tests


From: ELPA Syncer
Subject: [elpa] externals/compat 3e65059af7 3/7: Add func-arity tests
Date: Tue, 3 Jan 2023 09:57:27 -0500 (EST)

branch: externals/compat
commit 3e65059af71db18970c148aa227026dfd526ac5a
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Add func-arity tests
---
 compat-tests.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/compat-tests.el b/compat-tests.el
index 8c48733b96..86471caf74 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1817,6 +1817,17 @@ being compared against."
   (expect wrong-type-argument '(0 0 0 0 a))
   (expect wrong-type-argument '(0 0 0 0 0 a)))
 
+(compat-deftests func-arity
+  (should (equal '(0 . 0) (func-arity (lambda ()))))
+  (should (equal '(1 . 1) (func-arity (lambda (x) x))))
+  (should (equal '(1 . 2) (func-arity (lambda (x &optional _) x))))
+  (should (equal '(0 . many) (func-arity (lambda (&rest _)))))
+  (ought '(1 . 1) 'identity)
+  (ought '(0 . many) 'ignore)
+  (ought '(2 . many) 'defun)
+  (ought '(2 . 3) 'defalias)
+  (ought '(1 . unevalled) 'defvar))
+
 (compat-deftests subr-primitive-p
   (ought t (symbol-function 'identity))       ;function from fns.c
   (unless (fboundp 'subr-native-elisp-p)



reply via email to

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