diff options
| author | Mattias EngdegÄrd | 2022-08-30 16:44:51 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2022-08-30 16:48:25 +0200 |
| commit | e1e60e51bf324aaa2137075827c4d08a331a7bef (patch) | |
| tree | 7eb07197b4db9009b310ca85736076f0a97ac57d /test/src | |
| parent | 5cf7b1ada96c2e209580d086d15b1bbe5b345657 (diff) | |
| download | emacs-e1e60e51bf324aaa2137075827c4d08a331a7bef.tar.gz emacs-e1e60e51bf324aaa2137075827c4d08a331a7bef.zip | |
Accept bignum arguments in `take` and `ntake`
* src/fns.c (Ftake, Fntake): Accept any integer as first argument, for
completeness.
* test/src/fns-tests.el (fns--take-ntake): Add test cases.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/fns-tests.el | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index a84cce3ad4e..4ef428af03e 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el | |||
| @@ -1412,6 +1412,14 @@ | |||
| 1412 | (should (equal (take 5 list) '(a b c b c))) | 1412 | (should (equal (take 5 list) '(a b c b c))) |
| 1413 | (should (equal (take 10 list) '(a b c b c b c b c b))) | 1413 | (should (equal (take 10 list) '(a b c b c b c b c b))) |
| 1414 | 1414 | ||
| 1415 | (should (equal (ntake 10 list) '(a b))))) | 1415 | (should (equal (ntake 10 list) '(a b)))) |
| 1416 | |||
| 1417 | ;; Bignum N argument. | ||
| 1418 | (let ((list (list 'a 'b 'c))) | ||
| 1419 | (should (equal (take (+ most-positive-fixnum 1) list) '(a b c))) | ||
| 1420 | (should (equal (take (- most-negative-fixnum 1) list) nil)) | ||
| 1421 | (should (equal (ntake (+ most-positive-fixnum 1) list) '(a b c))) | ||
| 1422 | (should (equal (ntake (- most-negative-fixnum 1) list) nil)) | ||
| 1423 | (should (equal list '(a b c))))) | ||
| 1416 | 1424 | ||
| 1417 | ;;; fns-tests.el ends here | 1425 | ;;; fns-tests.el ends here |