all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob 05e81a52f016a99439d3def66a78c54fed57c137 2312 bytes (raw)
name: test/lisp/overlay-tests.el 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
 



(require 'ert)

(ert-deftest overlay-create-test ()
  "  "
  (with-temp-buffer
    (insert  "blueberrypancakes")
    (let ((o1 (make-overlay 4 9)))
      (should-not (overlay-get o1 'face))
      (should (overlayp o1))
      (should (= (overlay-start o1) 4))
      (should (= (overlay-end o1) 9))
      (should (eq (overlay-buffer o1) (current-buffer)))
      (let ((b (current-buffer)))
        (with-temp-buffer
          (should (eq (overlay-buffer o1) b))))
      (should (= (length (overlays-in (point-min) (point-max))) 1))
      (should (eq (car (overlays-in (point-min) (point-max))) o1)))))


(ert-deftest overlay-move-test ()
  "  "
  (with-temp-buffer
    (insert "blueberrypancakes")
    (let ((o1 (make-overlay 4 9)))
      ;; Test a "normal" move
      (should (= (overlay-start o1) 4))
      (should (= (overlay-end o1) 9))
      (should (eq (overlay-buffer o1) (current-buffer)))    
      (move-overlay o1 3 10)
      (should (= (overlay-start o1) 3))
      (should (= (overlay-end o1) 10))
      (let ((b (current-buffer)))
        (with-temp-buffer
          (insert "blueberry")
          (move-overlay o1 2 4)
          (should (eq (overlay-buffer o1) b))
          (move-overlay o1 2 4 (current-buffer))
          (should (eq (overlay-buffer o1) (current-buffer)))
          (should (= (overlay-start o1) 2))
          (should (= (overlay-end o1) 4))))
      (move-overlay o1 1 50 (current-buffer))
      (should (eq (overlay-buffer o1) (current-buffer)))    
      (should (= (overlay-start o1) 1))
      (should (= (overlay-end o1) (point-max))))))
  
(ert-deftest overlay-front-advance-test ()
  (with-temp-buffer
    (insert "blueberrypancakes")
    (let ((o1 (make-overlay 1 5 nil t))
          (o2 (make-overlay 1 5))
          (str "creamy "))
      (goto-char (point-min))
      (insert str)
      (should (= (overlay-start o2) 1))
      (should (= (overlay-start o1) (1+ (length str)))))))

(ert-deftest overlay-rear-advance-test ()
  (with-temp-buffer
    (insert "blueberrypancakes")
    (let ((o1 (make-overlay 7 18 nil nil t))
          (o2 (make-overlay 7 18))
          (str " for dinner"))
      (should (= (point-max) 18))
      (goto-char (point-max))
      (insert str)
      (should (= (overlay-end o1) (point-max)))
      (should (= (overlay-end o2) 18)))))
      


debug log:

solving 05e81a5 ...
found 05e81a5 in https://yhetil.org/emacs/87d1jylv43.fsf@fastmail.com/

applying [1/1] https://yhetil.org/emacs/87d1jylv43.fsf@fastmail.com/
diff --git a/test/lisp/overlay-tests.el b/test/lisp/overlay-tests.el
new file mode 100644
index 0000000..05e81a5

1:37: trailing whitespace.
      (should (eq (overlay-buffer o1) (current-buffer)))    
1:51: trailing whitespace.
      (should (eq (overlay-buffer o1) (current-buffer)))    
1:54: trailing whitespace.
  
1:77: trailing whitespace.
      
Checking patch test/lisp/overlay-tests.el...
1:77: new blank line at EOF.
+
Applied patch test/lisp/overlay-tests.el cleanly.
warning: 5 lines add whitespace errors.

index at:
100644 05e81a52f016a99439d3def66a78c54fed57c137	test/lisp/overlay-tests.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.