[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat eb1c1fb 2/2: Fix compat--proper-list-p-length-si
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat eb1c1fb 2/2: Fix compat--proper-list-p-length-signal for non-list sequences |
Date: |
Mon, 15 Nov 2021 15:57:12 -0500 (EST) |
branch: externals/compat
commit eb1c1fb4a1ec462e56a13e93baa4fe9963278b6f
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Fix compat--proper-list-p-length-signal for non-list sequences
---
compat-27.1.el | 2 +-
compat-tests.el | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/compat-27.1.el b/compat-27.1.el
index e182585..8a44f39 100644
--- a/compat-27.1.el
+++ b/compat-27.1.el
@@ -40,7 +40,7 @@ is nil)."
:max-version "26.3"
:realname compat--proper-list-p-length-signal
(condition-case nil
- (length object)
+ (and (listp object) (length object))
(wrong-type-argument nil)
(circular-list nil)))
diff --git a/compat-tests.el b/compat-tests.el
index cdf315a..9aa27fa 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -462,7 +462,12 @@ the compatibility function."
(compat--should nil '(1 2 . 3)) ;dotted
(compat--should nil (let ((l (list 1 2 3))) ;circular
(setf (nthcdr 3 l) l)
- l))))
+ l))
+ (compat--should nil 1) ;non-lists
+ (compat--should nil "")
+ (compat--should nil "abc")
+ (compat--should nil [])
+ (compat--should nil [1 2 3])))
(ert-deftest compat-proper-list-p-2 ()
"Check if `compat--proper-list-p' was implemented correctly (<25.3)."
@@ -474,7 +479,13 @@ the compatibility function."
(compat--should nil '(1 2 . 3)) ;dotted
(compat--should nil (let ((l (list 1 2 3))) ;circular
(setf (nthcdr 3 l) l)
- l))))
+ l))
+ (compat--should nil 1) ;non-lists
+ (compat--should nil "")
+ (compat--should nil "abc")
+ (compat--should nil [])
+ (compat--should nil [1 2 3])))
+
(ert-deftest compat-flatten-tree ()
"Check if `compat--flatten-tree' was implemented correctly."