diff options
| author | Eric S. Raymond | 2026-02-25 13:13:11 -0500 |
|---|---|---|
| committer | Eric S. Raymond | 2026-02-25 13:21:25 -0500 |
| commit | 95329bf445841a763bafa4ea5e853fc1c6f6bf0a (patch) | |
| tree | cad54964a574adcc6b1aee98af2906220928fd30 /test/src | |
| parent | e42c579a544d3d254e55db2f6b70e55205987d36 (diff) | |
| download | emacs-95329bf445841a763bafa4ea5e853fc1c6f6bf0a.tar.gz emacs-95329bf445841a763bafa4ea5e853fc1c6f6bf0a.zip | |
More test coverage improvements.
Bignum corner-case tests in data-tests.el.
More buffer-primitive tests in editfns-test.el
Some condition-case tesrs in eval-tests.el.
And another marker-primitive test in marker-tests.el.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/data-tests.el | 7 | ||||
| -rw-r--r-- | test/src/editfns-tests.el | 27 | ||||
| -rw-r--r-- | test/src/eval-tests.el | 16 | ||||
| -rw-r--r-- | test/src/marker-tests.el | 18 |
4 files changed, 68 insertions, 0 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index fa2b4d7c4e6..7c0796c5d2a 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el | |||
| @@ -815,6 +815,13 @@ comparing the subr with a much slower Lisp implementation." | |||
| 815 | (should (= (lognot n) (- -1 n))) | 815 | (should (= (lognot n) (- -1 n))) |
| 816 | (should (= (lognot m) (- -1 m))))) | 816 | (should (= (lognot m) (- -1 m))))) |
| 817 | 817 | ||
| 818 | (ert-deftest data-tests-bignum-bit-identities () | ||
| 819 | (let ((n (1+ most-positive-fixnum))) | ||
| 820 | (should (bignump n)) | ||
| 821 | (should (= (logand n (lognot n)) 0)) | ||
| 822 | (should (= (logior n (lognot n)) -1)) | ||
| 823 | (should (= (logxor n n) 0)))) | ||
| 824 | |||
| 818 | (ert-deftest data-tests-logior () | 825 | (ert-deftest data-tests-logior () |
| 819 | (should (= -1 (logior -1) (logior -1 -1))) | 826 | (should (= -1 (logior -1) (logior -1 -1))) |
| 820 | (should (= -1 (logior most-positive-fixnum most-negative-fixnum)))) | 827 | (should (= -1 (logior most-positive-fixnum most-negative-fixnum)))) |
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index bbe7199bdcd..0f5e0adc419 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el | |||
| @@ -1058,6 +1058,33 @@ sufficiently large to avoid truncation." | |||
| 1058 | (goto-char (point-max)) | 1058 | (goto-char (point-max)) |
| 1059 | (should (= (following-char) 0)))) | 1059 | (should (= (following-char) 0)))) |
| 1060 | 1060 | ||
| 1061 | (ert-deftest editfns-tests--buffer-substring-properties () | ||
| 1062 | (with-temp-buffer | ||
| 1063 | (insert "abc") | ||
| 1064 | (add-text-properties (point-min) (point-max) '(foo bar)) | ||
| 1065 | (let ((with-props (buffer-substring (point-min) (point-max))) | ||
| 1066 | (without-props (buffer-substring-no-properties | ||
| 1067 | (point-min) (point-max)))) | ||
| 1068 | (should (equal with-props "abc")) | ||
| 1069 | (should (equal without-props "abc")) | ||
| 1070 | (should (eq (get-text-property 0 'foo with-props) 'bar)) | ||
| 1071 | (should-not (get-text-property 0 'foo without-props))))) | ||
| 1072 | |||
| 1073 | (ert-deftest editfns-tests--insert-and-inherit () | ||
| 1074 | (with-temp-buffer | ||
| 1075 | (insert "a") | ||
| 1076 | (add-text-properties 1 2 '(foo bar)) | ||
| 1077 | (goto-char (point-max)) | ||
| 1078 | (insert "b") | ||
| 1079 | (should-not (get-text-property 2 'foo)) | ||
| 1080 | (erase-buffer)) | ||
| 1081 | (with-temp-buffer | ||
| 1082 | (insert "a") | ||
| 1083 | (add-text-properties 1 2 '(foo bar)) | ||
| 1084 | (goto-char (point-max)) | ||
| 1085 | (insert-and-inherit "b") | ||
| 1086 | (should (eq (get-text-property 2 'foo) 'bar)))) | ||
| 1087 | |||
| 1061 | (ert-deftest editfns-tests--line-beginning-end-position () | 1088 | (ert-deftest editfns-tests--line-beginning-end-position () |
| 1062 | (with-temp-buffer | 1089 | (with-temp-buffer |
| 1063 | (insert "aa\nbb\ncc") | 1090 | (insert "aa\nbb\ncc") |
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el index 1e7c33069a7..686508a6a8d 100644 --- a/test/src/eval-tests.el +++ b/test/src/eval-tests.el | |||
| @@ -374,6 +374,22 @@ expressions works for identifiers starting with period." | |||
| 374 | (error err)))) | 374 | (error err)))) |
| 375 | (should (eq inner-error outer-error)))) | 375 | (should (eq inner-error outer-error)))) |
| 376 | 376 | ||
| 377 | (ert-deftest eval-tests--condition-case-basic () | ||
| 378 | (should (equal (condition-case err | ||
| 379 | 42 | ||
| 380 | (error (list 'err err))) | ||
| 381 | 42)) | ||
| 382 | (should (equal (condition-case err | ||
| 383 | (signal 'wrong-type-argument '(integerp "x")) | ||
| 384 | (wrong-type-argument (list 'wt err)) | ||
| 385 | (error (list 'err err))) | ||
| 386 | '(wt (wrong-type-argument integerp "x")))) | ||
| 387 | (should (equal (condition-case err | ||
| 388 | (signal 'error '("boom")) | ||
| 389 | (wrong-type-argument (list 'wt err)) | ||
| 390 | (error (list 'err err))) | ||
| 391 | '(err (error "boom"))))) | ||
| 392 | |||
| 377 | (ert-deftest eval-bad-specbind () | 393 | (ert-deftest eval-bad-specbind () |
| 378 | (should-error (eval '(let (((a b) 23)) (+ 1 2)) t) | 394 | (should-error (eval '(let (((a b) 23)) (+ 1 2)) t) |
| 379 | :type 'wrong-type-argument) | 395 | :type 'wrong-type-argument) |
diff --git a/test/src/marker-tests.el b/test/src/marker-tests.el index 19ecca2d0af..4311a82693b 100644 --- a/test/src/marker-tests.el +++ b/test/src/marker-tests.el | |||
| @@ -124,4 +124,22 @@ | |||
| 124 | (should (= (marker-position maxm) 3)) | 124 | (should (= (marker-position maxm) 3)) |
| 125 | (should (eq (marker-buffer minm) (current-buffer)))))) | 125 | (should (eq (marker-buffer minm) (current-buffer)))))) |
| 126 | 126 | ||
| 127 | (ert-deftest marker-tests--move-marker-between-buffers () | ||
| 128 | (let ((buf-1 (generate-new-buffer " *marker-tests-1*")) | ||
| 129 | (buf-2 (generate-new-buffer " *marker-tests-2*"))) | ||
| 130 | (unwind-protect | ||
| 131 | (let ((m (make-marker))) | ||
| 132 | (with-current-buffer buf-1 | ||
| 133 | (insert "abc") | ||
| 134 | (set-marker m 2 (current-buffer))) | ||
| 135 | (should (eq (marker-buffer m) buf-1)) | ||
| 136 | (should (= (marker-position m) 2)) | ||
| 137 | (with-current-buffer buf-2 | ||
| 138 | (insert "xyz") | ||
| 139 | (set-marker m 1 (current-buffer))) | ||
| 140 | (should (eq (marker-buffer m) buf-2)) | ||
| 141 | (should (= (marker-position m) 1))) | ||
| 142 | (kill-buffer buf-1) | ||
| 143 | (kill-buffer buf-2)))) | ||
| 144 | |||
| 127 | ;;; marker-tests.el ends here | 145 | ;;; marker-tests.el ends here |