mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-06-14 04:21:24 +00:00
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.
This commit is contained in:
parent
e42c579a54
commit
95329bf445
4 changed files with 68 additions and 0 deletions
|
|
@ -815,6 +815,13 @@ comparing the subr with a much slower Lisp implementation."
|
|||
(should (= (lognot n) (- -1 n)))
|
||||
(should (= (lognot m) (- -1 m)))))
|
||||
|
||||
(ert-deftest data-tests-bignum-bit-identities ()
|
||||
(let ((n (1+ most-positive-fixnum)))
|
||||
(should (bignump n))
|
||||
(should (= (logand n (lognot n)) 0))
|
||||
(should (= (logior n (lognot n)) -1))
|
||||
(should (= (logxor n n) 0))))
|
||||
|
||||
(ert-deftest data-tests-logior ()
|
||||
(should (= -1 (logior -1) (logior -1 -1)))
|
||||
(should (= -1 (logior most-positive-fixnum most-negative-fixnum))))
|
||||
|
|
|
|||
|
|
@ -1058,6 +1058,33 @@ sufficiently large to avoid truncation."
|
|||
(goto-char (point-max))
|
||||
(should (= (following-char) 0))))
|
||||
|
||||
(ert-deftest editfns-tests--buffer-substring-properties ()
|
||||
(with-temp-buffer
|
||||
(insert "abc")
|
||||
(add-text-properties (point-min) (point-max) '(foo bar))
|
||||
(let ((with-props (buffer-substring (point-min) (point-max)))
|
||||
(without-props (buffer-substring-no-properties
|
||||
(point-min) (point-max))))
|
||||
(should (equal with-props "abc"))
|
||||
(should (equal without-props "abc"))
|
||||
(should (eq (get-text-property 0 'foo with-props) 'bar))
|
||||
(should-not (get-text-property 0 'foo without-props)))))
|
||||
|
||||
(ert-deftest editfns-tests--insert-and-inherit ()
|
||||
(with-temp-buffer
|
||||
(insert "a")
|
||||
(add-text-properties 1 2 '(foo bar))
|
||||
(goto-char (point-max))
|
||||
(insert "b")
|
||||
(should-not (get-text-property 2 'foo))
|
||||
(erase-buffer))
|
||||
(with-temp-buffer
|
||||
(insert "a")
|
||||
(add-text-properties 1 2 '(foo bar))
|
||||
(goto-char (point-max))
|
||||
(insert-and-inherit "b")
|
||||
(should (eq (get-text-property 2 'foo) 'bar))))
|
||||
|
||||
(ert-deftest editfns-tests--line-beginning-end-position ()
|
||||
(with-temp-buffer
|
||||
(insert "aa\nbb\ncc")
|
||||
|
|
|
|||
|
|
@ -374,6 +374,22 @@ expressions works for identifiers starting with period."
|
|||
(error err))))
|
||||
(should (eq inner-error outer-error))))
|
||||
|
||||
(ert-deftest eval-tests--condition-case-basic ()
|
||||
(should (equal (condition-case err
|
||||
42
|
||||
(error (list 'err err)))
|
||||
42))
|
||||
(should (equal (condition-case err
|
||||
(signal 'wrong-type-argument '(integerp "x"))
|
||||
(wrong-type-argument (list 'wt err))
|
||||
(error (list 'err err)))
|
||||
'(wt (wrong-type-argument integerp "x"))))
|
||||
(should (equal (condition-case err
|
||||
(signal 'error '("boom"))
|
||||
(wrong-type-argument (list 'wt err))
|
||||
(error (list 'err err)))
|
||||
'(err (error "boom")))))
|
||||
|
||||
(ert-deftest eval-bad-specbind ()
|
||||
(should-error (eval '(let (((a b) 23)) (+ 1 2)) t)
|
||||
:type 'wrong-type-argument)
|
||||
|
|
|
|||
|
|
@ -124,4 +124,22 @@
|
|||
(should (= (marker-position maxm) 3))
|
||||
(should (eq (marker-buffer minm) (current-buffer))))))
|
||||
|
||||
(ert-deftest marker-tests--move-marker-between-buffers ()
|
||||
(let ((buf-1 (generate-new-buffer " *marker-tests-1*"))
|
||||
(buf-2 (generate-new-buffer " *marker-tests-2*")))
|
||||
(unwind-protect
|
||||
(let ((m (make-marker)))
|
||||
(with-current-buffer buf-1
|
||||
(insert "abc")
|
||||
(set-marker m 2 (current-buffer)))
|
||||
(should (eq (marker-buffer m) buf-1))
|
||||
(should (= (marker-position m) 2))
|
||||
(with-current-buffer buf-2
|
||||
(insert "xyz")
|
||||
(set-marker m 1 (current-buffer)))
|
||||
(should (eq (marker-buffer m) buf-2))
|
||||
(should (= (marker-position m) 1)))
|
||||
(kill-buffer buf-1)
|
||||
(kill-buffer buf-2))))
|
||||
|
||||
;;; marker-tests.el ends here
|
||||
|
|
|
|||
Loading…
Reference in a new issue