summaryrefslogtreecommitdiff
path: root/test/src/editfns-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/editfns-tests.el')
-rw-r--r--test/src/editfns-tests.el22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 6e1f730166d..442ad089375 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -142,27 +142,41 @@
(should (string-equal (format "%#05X" #x10) "0X010"))
(should (string-equal (format "%#04x" 0) "0000")))
-;;; Test Bug#30408.
+
+;;; Tests for Bug#30408.
+
(ert-deftest format-%d-large-float ()
(should (string-equal (format "%d" 18446744073709551616.0)
"18446744073709551616"))
(should (string-equal (format "%d" -18446744073709551616.0)
"-18446744073709551616")))
-;;; Another test for Bug#30408.
;;; Perhaps Emacs will be improved someday to return the correct
;;; answer for positive numbers instead of overflowing; in
-;;; that case this test will need to be changed. In the meantime make
+;;; that case these tests will need to be changed. In the meantime make
;;; sure Emacs is reporting the overflow correctly.
(ert-deftest format-%x-large-float ()
(should-error (format "%x" 18446744073709551616.0)
:type 'overflow-error))
+(ert-deftest read-large-integer ()
+ (should-error (read (format "%d0" most-negative-fixnum))
+ :type 'overflow-error)
+ (should-error (read (format "%+d" (* -8.0 most-negative-fixnum)))
+ :type 'overflow-error)
+ (should-error (read (substring (format "%d" most-negative-fixnum) 1))
+ :type 'overflow-error)
+ (should-error (read (format "#x%x" most-negative-fixnum))
+ :type 'overflow-error)
+ (should-error (read (format "#o%o" most-negative-fixnum))
+ :type 'overflow-error)
+ (should-error (read (format "#32rG%x" most-positive-fixnum))
+ :type 'overflow-error))
-;;; Another test for Bug#30408.
(ert-deftest format-%o-invalid-float ()
(should-error (format "%o" -1e-37)
:type 'overflow-error))
+
;;; Check format-time-string with various TZ settings.
;;; Use only POSIX-compatible TZ values, since the tests should work
;;; even if tzdb is not in use.