[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 9257871cb0 3/7: Test take and ntake
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 9257871cb0 3/7: Test take and ntake |
Date: |
Wed, 4 Jan 2023 13:57:28 -0500 (EST) |
branch: externals/compat
commit 9257871cb0b8bbe2135f49e1b7ff5b4462b37e53
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Test take and ntake
---
compat-29.el | 4 ++--
compat-tests.el | 10 ++++++++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/compat-29.el b/compat-29.el
index 25ac016f98..48470d49f7 100644
--- a/compat-29.el
+++ b/compat-29.el
@@ -79,7 +79,7 @@ WINDOW."
;;;; Defined in fns.c
-(compat-defun ntake (n list) ;; <UNTESTED>
+(compat-defun ntake (n list) ;; <OK>
"Modify LIST to keep only the first N elements.
If N is zero or negative, return nil.
If N is greater or equal to the length of LIST, return LIST unmodified.
@@ -88,7 +88,7 @@ Otherwise, return LIST after truncating it."
(when cons (setcdr cons nil))
list)))
-(compat-defun take (n list) ;; <UNTESTED>
+(compat-defun take (n list) ;; <OK>
"Return the first N elements of LIST.
If N is zero or negative, return nil.
If N is greater or equal to the length of LIST, return LIST (or a copy)."
diff --git a/compat-tests.el b/compat-tests.el
index 43b59836b0..2beb7a3c34 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -46,6 +46,16 @@
(defmacro should-equal (a b)
`(should (equal ,a ,b)))
+(ert-deftest ntake ()
+ (should-not (ntake 5 nil))
+ (should-equal '(1 2) (ntake 5 '(1 2)))
+ (should-equal '(1 2 3) (ntake 3 '(1 2 3 4))))
+
+(ert-deftest take ()
+ (should-not (take 5 nil))
+ (should-equal '(1 2) (take 5 '(1 2)))
+ (should-equal '(1 2 3) (take 3 '(1 2 3 4))))
+
(ert-deftest format-message ()
(should-equal (format-message "a=%s b=%s" 1 2) "a=1 b=2"))
- [elpa] externals/compat updated (8144719780 -> f0362f354c), ELPA Syncer, 2023/01/04
- [elpa] externals/compat 8ab4272a5d 5/7: Add thread-first and thread-last tests, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 9257871cb0 3/7: Test take and ntake,
ELPA Syncer <=
- [elpa] externals/compat 01ed1c6737 1/7: Drop broken func-arity, ELPA Syncer, 2023/01/04
- [elpa] externals/compat f0362f354c 7/7: Warn about untested functions, ELPA Syncer, 2023/01/04
- [elpa] externals/compat fc2ad0899d 6/7: Test buffer-local-boundp, ELPA Syncer, 2023/01/04
- [elpa] externals/compat b126fd50df 2/7: Mark a few functions as tested, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 1d25236892 4/7: Use with-eval-after-load (24.4), ELPA Syncer, 2023/01/04