summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-05-27 12:17:15 +0300
committerEli Zaretskii <eliz@gnu.org>2016-05-27 12:17:15 +0300
commitf7ffc4b7d36041eba2abe9bc34927413f48056d4 (patch)
tree21016675c4b801c9a7d40e8b69e369a9ca92429b /test
parent4ab2673d87794dbbe4db33856c0dc69e4b06db71 (diff)
downloademacs-f7ffc4b7d36041eba2abe9bc34927413f48056d4.tar.gz
Fix infloop in 'number-sequence'
* lisp/subr.el (number-sequence): Avoid overflow leading to an infloop. (Bug#23627) * test/automated/subr-tests.el (number-sequence-test): New test.
Diffstat (limited to 'test')
-rw-r--r--test/automated/subr-tests.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/automated/subr-tests.el b/test/automated/subr-tests.el
index 7906a207a96..ce212903c9d 100644
--- a/test/automated/subr-tests.el
+++ b/test/automated/subr-tests.el
@@ -61,6 +61,15 @@
(quote
(0 font-lock-keyword-face))))))))
+(ert-deftest number-sequence-test ()
+ (should (= (length
+ (number-sequence (1- most-positive-fixnum) most-positive-fixnum))
+ 2))
+ (should (= (length
+ (number-sequence
+ (1+ most-negative-fixnum) most-negative-fixnum -1))
+ 2)))
+
(ert-deftest string-comparison-test ()
(should (string-lessp "abc" "acb"))
(should (string-lessp "aBc" "abc"))