diff options
| author | Stephen Leake | 2019-07-30 11:03:15 -0700 |
|---|---|---|
| committer | Stephen Leake | 2019-07-30 11:03:15 -0700 |
| commit | 01739625704aaaea6831cef459a4a53171689513 (patch) | |
| tree | ef9f324b3fa6696647c6e637e436ee6160155b92 /test/src | |
| parent | 056cbcb7a959463290bc91c19b909cbf3eb47d0a (diff) | |
| parent | 9b480db6732c6d2e886838f112d9bd46fc8989bf (diff) | |
| download | emacs-01739625704aaaea6831cef459a4a53171689513.tar.gz emacs-01739625704aaaea6831cef459a4a53171689513.zip | |
Merge commit '9b480db6732c6d2e886838f112d9bd46fc8989bf'
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/editfns-tests.el | 23 | ||||
| -rw-r--r-- | test/src/fileio-tests.el | 11 |
2 files changed, 23 insertions, 11 deletions
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 69cca5d2bdd..a1060808f66 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -165,13 +165,9 @@ | |||
| 165 | (should (string-equal (format "%d" -18446744073709551616.0) | 165 | (should (string-equal (format "%d" -18446744073709551616.0) |
| 166 | "-18446744073709551616"))) | 166 | "-18446744073709551616"))) |
| 167 | 167 | ||
| 168 | ;; Perhaps Emacs will be improved someday to return the correct | ||
| 169 | ;; answer for positive numbers instead of overflowing; in | ||
| 170 | ;; that case these tests will need to be changed. In the meantime make | ||
| 171 | ;; sure Emacs is reporting the overflow correctly. | ||
| 172 | (ert-deftest format-%x-large-float () | 168 | (ert-deftest format-%x-large-float () |
| 173 | (should-error (format "%x" 18446744073709551616.0) | 169 | (should (string-equal (format "%x" 18446744073709551616.0) |
| 174 | :type 'overflow-error)) | 170 | "10000000000000000"))) |
| 175 | (ert-deftest read-large-integer () | 171 | (ert-deftest read-large-integer () |
| 176 | (should (eq (type-of (read (format "%d0" most-negative-fixnum))) 'integer)) | 172 | (should (eq (type-of (read (format "%d0" most-negative-fixnum))) 'integer)) |
| 177 | (should (eq (type-of (read (format "%+d" (* -8.0 most-negative-fixnum)))) | 173 | (should (eq (type-of (read (format "%+d" (* -8.0 most-negative-fixnum)))) |
| @@ -188,11 +184,16 @@ | |||
| 188 | (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum) | 184 | (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum) |
| 189 | -1 0 1 | 185 | -1 0 1 |
| 190 | (1- most-positive-fixnum) most-positive-fixnum)) | 186 | (1- most-positive-fixnum) most-positive-fixnum)) |
| 191 | (should (eq val (read (format fmt val))))))) | 187 | (should (eq val (read (format fmt val))))) |
| 192 | 188 | (dolist (val (list (1+ most-positive-fixnum) | |
| 193 | (ert-deftest format-%o-invalid-float () | 189 | (* 2 (1+ most-positive-fixnum)) |
| 194 | (should-error (format "%o" -1e-37) | 190 | (* 4 (1+ most-positive-fixnum)) |
| 195 | :type 'overflow-error)) | 191 | (* 8 (1+ most-positive-fixnum)) |
| 192 | 18446744073709551616.0)) | ||
| 193 | (should (= val (read (format fmt val))))))) | ||
| 194 | |||
| 195 | (ert-deftest format-%o-negative-float () | ||
| 196 | (should (string-equal (format "%o" -1e-37) "0"))) | ||
| 196 | 197 | ||
| 197 | ;; Bug#31938 | 198 | ;; Bug#31938 |
| 198 | (ert-deftest format-%d-float () | 199 | (ert-deftest format-%d-float () |
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 813ee5f798f..98d3d6be763 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el | |||
| @@ -136,3 +136,14 @@ Also check that an encoding error can appear in a symlink." | |||
| 136 | (name (expand-file-name "bar"))) | 136 | (name (expand-file-name "bar"))) |
| 137 | (should (and (file-name-absolute-p name) | 137 | (should (and (file-name-absolute-p name) |
| 138 | (not (eq (aref name 0) ?~)))))) | 138 | (not (eq (aref name 0) ?~)))))) |
| 139 | |||
| 140 | (ert-deftest fileio-tests--file-name-absolute-p () | ||
| 141 | "Test file-name-absolute-p." | ||
| 142 | (dolist (suffix '("" "/" "//" "/foo" "/foo/" "/foo//" "/foo/bar")) | ||
| 143 | (unless (string-equal suffix "") | ||
| 144 | (should (file-name-absolute-p suffix))) | ||
| 145 | (should (file-name-absolute-p (concat "~" suffix))) | ||
| 146 | (when (user-full-name user-login-name) | ||
| 147 | (should (file-name-absolute-p (concat "~" user-login-name suffix)))) | ||
| 148 | (unless (user-full-name "nosuchuser") | ||
| 149 | (should (not (file-name-absolute-p (concat "~nosuchuser" suffix))))))) | ||