diff options
| author | Tom Tromey | 2018-07-05 14:46:26 -0600 |
|---|---|---|
| committer | Tom Tromey | 2018-07-12 22:12:27 -0600 |
| commit | d14808cd271abf6a723bf495a6a01c14d18b5893 (patch) | |
| tree | a576eafcf67c615b5a49d90db71dbc3cbf14c35b /test/src | |
| parent | 23eab9a6a67604b5ebcdc99efc42fbfd3345c0b0 (diff) | |
| download | emacs-d14808cd271abf6a723bf495a6a01c14d18b5893.tar.gz emacs-d14808cd271abf6a723bf495a6a01c14d18b5893.zip | |
Make format handle bignums
* src/editfns.c (styled_format): Handle bignums.
* test/src/editfns-tests.el (read-large-integer): Update.
(format-bignum): New test.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/editfns-tests.el | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index c828000bb4f..501e0d87818 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -159,18 +159,17 @@ | |||
| 159 | (should-error (format "%x" 18446744073709551616.0) | 159 | (should-error (format "%x" 18446744073709551616.0) |
| 160 | :type 'overflow-error)) | 160 | :type 'overflow-error)) |
| 161 | (ert-deftest read-large-integer () | 161 | (ert-deftest read-large-integer () |
| 162 | (should-error (read (format "%d0" most-negative-fixnum)) | 162 | (should (eq (type-of (read (format "%d0" most-negative-fixnum))) 'integer)) |
| 163 | :type 'overflow-error) | 163 | (should (eq (type-of (read (format "%+d" (* -8.0 most-negative-fixnum)))) |
| 164 | (should-error (read (format "%+d" (* -8.0 most-negative-fixnum))) | 164 | 'integer)) |
| 165 | :type 'overflow-error) | 165 | (should (eq (type-of (read (substring (format "%d" most-negative-fixnum) 1))) |
| 166 | (should-error (read (substring (format "%d" most-negative-fixnum) 1)) | 166 | 'integer)) |
| 167 | :type 'overflow-error) | 167 | (should (eq (type-of (read (format "#x%x" most-negative-fixnum))) |
| 168 | (should-error (read (format "#x%x" most-negative-fixnum)) | 168 | 'integer)) |
| 169 | :type 'overflow-error) | 169 | (should (eq (type-of (read (format "#o%o" most-negative-fixnum))) |
| 170 | (should-error (read (format "#o%o" most-negative-fixnum)) | 170 | 'integer)) |
| 171 | :type 'overflow-error) | 171 | (should (eq (type-of (read (format "#32rG%x" most-positive-fixnum))) |
| 172 | (should-error (read (format "#32rG%x" most-positive-fixnum)) | 172 | 'integer))) |
| 173 | :type 'overflow-error)) | ||
| 174 | 173 | ||
| 175 | (ert-deftest format-%o-invalid-float () | 174 | (ert-deftest format-%o-invalid-float () |
| 176 | (should-error (format "%o" -1e-37) | 175 | (should-error (format "%o" -1e-37) |
| @@ -358,4 +357,14 @@ | |||
| 358 | (should (eq (type-of (car (nth 4 buffer-undo-list))) 'marker)) | 357 | (should (eq (type-of (car (nth 4 buffer-undo-list))) 'marker)) |
| 359 | (garbage-collect))) | 358 | (garbage-collect))) |
| 360 | 359 | ||
| 360 | (ert-deftest format-bignum () | ||
| 361 | (let* ((s1 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") | ||
| 362 | (v1 (read (concat "#x" s1))) | ||
| 363 | (s2 "99999999999999999999999999999999") | ||
| 364 | (v2 (read s2))) | ||
| 365 | (should (> v1 most-positive-fixnum)) | ||
| 366 | (should (equal (format "%X" v1) s1)) | ||
| 367 | (should (> v2 most-positive-fixnum)) | ||
| 368 | (should (equal (format "%d" v2) s2)))) | ||
| 369 | |||
| 361 | ;;; editfns-tests.el ends here | 370 | ;;; editfns-tests.el ends here |