diff options
| author | Paul Eggert | 2018-03-21 12:10:11 -0700 |
|---|---|---|
| committer | Paul Eggert | 2018-03-21 12:11:52 -0700 |
| commit | e70d0c9e66d7a8609450b2889869d16aeb0363b5 (patch) | |
| tree | 87e0b7af3ed19ad745cd7cd15e5c9f9e2cec9f71 /test/src | |
| parent | 56487467569713f8cee2285855bdcc26bfe9b517 (diff) | |
| download | emacs-e70d0c9e66d7a8609450b2889869d16aeb0363b5.tar.gz emacs-e70d0c9e66d7a8609450b2889869d16aeb0363b5.zip | |
Add tests for Bug#30408
* test/src/editfns-tests.el (format-%d-large-float)
(format-%x-large-float, format-%o-invalid-float): New tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/editfns-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 69ea6f5cc8f..6e1f730166d 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -142,6 +142,27 @@ | |||
| 142 | (should (string-equal (format "%#05X" #x10) "0X010")) | 142 | (should (string-equal (format "%#05X" #x10) "0X010")) |
| 143 | (should (string-equal (format "%#04x" 0) "0000"))) | 143 | (should (string-equal (format "%#04x" 0) "0000"))) |
| 144 | 144 | ||
| 145 | ;;; Test Bug#30408. | ||
| 146 | (ert-deftest format-%d-large-float () | ||
| 147 | (should (string-equal (format "%d" 18446744073709551616.0) | ||
| 148 | "18446744073709551616")) | ||
| 149 | (should (string-equal (format "%d" -18446744073709551616.0) | ||
| 150 | "-18446744073709551616"))) | ||
| 151 | |||
| 152 | ;;; Another test for Bug#30408. | ||
| 153 | ;;; Perhaps Emacs will be improved someday to return the correct | ||
| 154 | ;;; answer for positive numbers instead of overflowing; in | ||
| 155 | ;;; that case this test will need to be changed. In the meantime make | ||
| 156 | ;;; sure Emacs is reporting the overflow correctly. | ||
| 157 | (ert-deftest format-%x-large-float () | ||
| 158 | (should-error (format "%x" 18446744073709551616.0) | ||
| 159 | :type 'overflow-error)) | ||
| 160 | |||
| 161 | ;;; Another test for Bug#30408. | ||
| 162 | (ert-deftest format-%o-invalid-float () | ||
| 163 | (should-error (format "%o" -1e-37) | ||
| 164 | :type 'overflow-error)) | ||
| 165 | |||
| 145 | ;;; Check format-time-string with various TZ settings. | 166 | ;;; Check format-time-string with various TZ settings. |
| 146 | ;;; Use only POSIX-compatible TZ values, since the tests should work | 167 | ;;; Use only POSIX-compatible TZ values, since the tests should work |
| 147 | ;;; even if tzdb is not in use. | 168 | ;;; even if tzdb is not in use. |