annotate tests/automated/extent-tests.el @ 2940:3ee1c468b215

[xemacs-hg @ 2005-09-19 00:36:01 by mta] * configure.ac: Fix the cygwin, non-X build by adding XPM header and library files to XE_CFLAGS. Patch from Rick Rankin. * lib-src/installexe.sh: Don't add an exe extention to a file that already has one. Patch from Rick Rankin.
author mta
date Mon, 19 Sep 2005 00:36:05 +0000
parents 20ae8821c23d
children 189fb67ca31a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
468
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
1 ;; Copyright (C) 2001 Free Software Foundation, Inc.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
2
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
3 ;; Author: Hrvoje Niksic <hniksic@xemacs.org>
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
4 ;; Maintainer: Hrvoje Niksic <hniksic@xemacs.org>
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
5 ;; Created: 1999
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
6 ;; Keywords: tests
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
7
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
8 ;; This file is part of XEmacs.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
9
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
13 ;; any later version.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
14
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
18 ;; General Public License for more details.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
19
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
23 ;; 02111-1307, USA.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
24
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
25 ;;; Synched up with: Not in FSF.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
26
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
27 ;;; Commentary:
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
28
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
29 ;; Test extents operations.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
30 ;; See test-harness.el for instructions on how to run these tests.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
31
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
32 (eval-when-compile
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
33 (condition-case nil
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
34 (require 'test-harness)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
35 (file-error
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
36 (push "." load-path)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
37 (when (and (boundp 'load-file-name) (stringp load-file-name))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
38 (push (file-name-directory load-file-name) load-path))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
39 (require 'test-harness))))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
40
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
41
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
42 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
43 ;; Creating and attaching.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
44 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
45
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
46 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
47 (let ((extent (make-extent nil nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
48 (string "somecoolstring"))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
49
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
50 ;; Detached extent.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
51 (Assert (extent-detached-p extent))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
52
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
53 ;; Put it in a buffer.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
54 (set-extent-endpoints extent 1 1 (current-buffer))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
55 (Assert (eq (extent-object extent) (current-buffer)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
56
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
57 ;; And then into another buffer.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
58 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
59 (set-extent-endpoints extent 1 1 (current-buffer))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
60 (Assert (eq (extent-object extent) (current-buffer))))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
61
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
62 ;; Now that the buffer doesn't exist, extent should be detached
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
63 ;; again.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
64 (Assert (extent-detached-p extent))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
65
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
66 ;; This line crashes XEmacs 21.2.46 and prior.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
67 (set-extent-endpoints extent 1 (length string) string)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
68 (Assert (eq (extent-object extent) string))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
69 )
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
70
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
71 (let ((extent (make-extent 1 1)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
72 ;; By default, extent should be closed-open
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
73 (Assert (eq (get extent 'start-closed) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
74 (Assert (eq (get extent 'start-open) nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
75 (Assert (eq (get extent 'end-open) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
76 (Assert (eq (get extent 'end-closed) nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
77
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
78 ;; Make it closed-closed.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
79 (set-extent-property extent 'end-closed t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
80
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
81 (Assert (eq (get extent 'start-closed) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
82 (Assert (eq (get extent 'start-open) nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
83 (Assert (eq (get extent 'end-open) nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
84 (Assert (eq (get extent 'end-closed) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
85
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
86 ;; open-closed
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
87 (set-extent-property extent 'start-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
88
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
89 (Assert (eq (get extent 'start-closed) nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
90 (Assert (eq (get extent 'start-open) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
91 (Assert (eq (get extent 'end-open) nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
92 (Assert (eq (get extent 'end-closed) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
93
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
94 ;; open-open
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
95 (set-extent-property extent 'end-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
96
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
97 (Assert (eq (get extent 'start-closed) nil))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
98 (Assert (eq (get extent 'start-open) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
99 (Assert (eq (get extent 'end-open) t))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
100 (Assert (eq (get extent 'end-closed) nil)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
101
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
102 )
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
103
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
104 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
105 ;; Insertion behavior.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
106 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
107
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
108 (defun et-range (extent)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
109 "List (START-POSITION END-POSITION) of EXTENT."
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
110 (list (extent-start-position extent)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
111 (extent-end-position extent)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
112
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
113 (defun et-insert-at (string position)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
114 "Insert STRING at POSITION in the current buffer."
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
115 (save-excursion
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
116 (goto-char position)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
117 (insert string)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
118
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
119 ;; Test insertion at the beginning, middle, and end of the extent.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
120
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
121 ;; closed-open
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
122
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
123 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
124 (insert "###eee###")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
125 (let ((e (make-extent 4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
126 ;; current state: "###[eee)###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
127 ;; 123 456 789
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
128 (Assert (equal (et-range e) '(4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
129
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
130 (et-insert-at "xxx" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
131
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
132 ;; current state: "###[xxxeee)###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
133 ;; 123 456789 012
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
134 (Assert (equal (et-range e) '(4 10)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
135
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
136 (et-insert-at "yyy" 7)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
137
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
138 ;; current state: "###[xxxyyyeee)###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
139 ;; 123 456789012 345
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
140 (Assert (equal (et-range e) '(4 13)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
141
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
142 (et-insert-at "zzz" 13)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
143
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
144 ;; current state: "###[xxxyyyeee)zzz###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
145 ;; 123 456789012 345678
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
146 (Assert (equal (et-range e) '(4 13)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
147 ))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
148
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
149 ;; closed-closed
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
150
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
151 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
152 (insert "###eee###")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
153 (let ((e (make-extent 4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
154 (put e 'end-closed t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
155
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
156 ;; current state: "###[eee]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
157 ;; 123 456 789
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
158 (Assert (equal (et-range e) '(4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
159
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
160 (et-insert-at "xxx" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
161
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
162 ;; current state: "###[xxxeee]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
163 ;; 123 456789 012
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
164 (Assert (equal (et-range e) '(4 10)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
165
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
166 (et-insert-at "yyy" 7)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
167
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
168 ;; current state: "###[xxxyyyeee]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
169 ;; 123 456789012 345
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
170 (Assert (equal (et-range e) '(4 13)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
171
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
172 (et-insert-at "zzz" 13)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
173
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
174 ;; current state: "###[xxxyyyeeezzz]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
175 ;; 123 456789012345 678
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
176 (Assert (equal (et-range e) '(4 16)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
177 ))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
178
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
179 ;; open-closed
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
180
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
181 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
182 (insert "###eee###")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
183 (let ((e (make-extent 4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
184 (put e 'start-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
185 (put e 'end-closed t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
186
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
187 ;; current state: "###(eee]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
188 ;; 123 456 789
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
189 (Assert (equal (et-range e) '(4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
190
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
191 (et-insert-at "xxx" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
192
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
193 ;; current state: "###xxx(eee]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
194 ;; 123456 789 012
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
195 (Assert (equal (et-range e) '(7 10)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
196
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
197 (et-insert-at "yyy" 8)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
198
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
199 ;; current state: "###xxx(eyyyee]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
200 ;; 123456 789012 345
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
201 (Assert (equal (et-range e) '(7 13)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
202
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
203 (et-insert-at "zzz" 13)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
204
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
205 ;; current state: "###xxx(eyyyeezzz]###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
206 ;; 123456 789012345 678
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
207 (Assert (equal (et-range e) '(7 16)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
208 ))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
209
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
210 ;; open-open
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
211
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
212 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
213 (insert "###eee###")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
214 (let ((e (make-extent 4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
215 (put e 'start-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
216
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
217 ;; current state: "###(eee)###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
218 ;; 123 456 789
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
219 (Assert (equal (et-range e) '(4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
220
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
221 (et-insert-at "xxx" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
222
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
223 ;; current state: "###xxx(eee)###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
224 ;; 123456 789 012
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
225 (Assert (equal (et-range e) '(7 10)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
226
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
227 (et-insert-at "yyy" 8)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
228
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
229 ;; current state: "###xxx(eyyyee)###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
230 ;; 123456 789012 345
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
231 (Assert (equal (et-range e) '(7 13)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
232
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
233 (et-insert-at "zzz" 13)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
234
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
235 ;; current state: "###xxx(eyyyee)zzz###"
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
236 ;; 123456 789012 345678
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
237 (Assert (equal (et-range e) '(7 13)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
238 ))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
239
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
240
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
241 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
242 ;; Deletion behavior.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
243 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
244
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
245 (dolist (props '((start-closed t end-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
246 (start-closed t end-open nil)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
247 (start-closed nil end-open nil)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
248 (start-closed nil end-open t)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
249 ;; Deletion needs to behave the same regardless of the open-ness of
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
250 ;; the boundaries.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
251
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
252 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
253 (insert "xxxxxxxxxx")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
254 (let ((e (make-extent 3 9)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
255 (set-extent-properties e props)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
256
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
257 ;; current state: xx[xxxxxx]xx
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
258 ;; 12 345678 90
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
259 (Assert (equal (et-range e) '(3 9)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
260
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
261 (delete-region 1 2)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
262
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
263 ;; current state: x[xxxxxx]xx
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
264 ;; 1 234567 89
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
265 (Assert (equal (et-range e) '(2 8)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
266
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
267 (delete-region 2 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
268
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
269 ;; current state: x[xxxx]xx
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
270 ;; 1 2345 67
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
271 (Assert (equal (et-range e) '(2 6)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
272
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
273 (delete-region 1 3)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
274
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
275 ;; current state: [xxx]xx
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
276 ;; 123 45
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
277 (Assert (equal (et-range e) '(1 4)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
278
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
279 (delete-region 3 5)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
280
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
281 ;; current state: [xx]x
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
282 ;; 12 3
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
283 (Assert (equal (et-range e) '(1 3)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
284
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
285 )))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
286
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
287 ;;; #### Should have a test for read-only-ness and insertion and
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
288 ;;; deletion!
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
289
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
290 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
291 ;; `detachable' property
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
292 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
293
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
294 (dolist (props '((start-closed t end-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
295 (start-closed t end-open nil)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
296 (start-closed nil end-open nil)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
297 (start-closed nil end-open t)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
298 ;; `detachable' shouldn't relate to region properties, hence the
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
299 ;; loop.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
300 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
301 (insert "###eee###")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
302 (let ((e (make-extent 4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
303 (set-extent-properties e props)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
304 (Assert (get e 'detachable))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
305
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
306 (Assert (not (extent-detached-p e)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
307
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
308 (delete-region 4 5)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
309 ;; ###ee### (not detached yet)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
310 (Assert (not (extent-detached-p e)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
311
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
312 (delete-region 4 6)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
313 ;; ###### (should be detached now)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
314 (Assert (extent-detached-p e))))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
315
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
316 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
317 (insert "###eee###")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
318 (let ((e (make-extent 4 7)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
319 (set-extent-properties e props)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
320 (put e 'detachable nil)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
321 (Assert (not (get e 'detachable)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
322
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
323 (Assert (not (extent-detached-p e)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
324
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
325 (delete-region 4 5)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
326 ;; ###ee###
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
327 (Assert (not (extent-detached-p e)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
328
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
329 (delete-region 4 6)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
330 ;; ###[]###
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
331 (Assert (not (extent-detached-p e)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
332 (Assert (equal (et-range e) '(4 4)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
333 ))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
334 )
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
335
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
336
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
337 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
338 ;; Zero-length extents.
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
339 ;;-----------------------------------------------------
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
340
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
341 ;; closed-open (should stay put)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
342 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
343 (insert "######")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
344 (let ((e (make-extent 4 4)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
345 (et-insert-at "foo" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
346 (Assert (equal (et-range e) '(4 4)))))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
347
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
348 ;; open-closed (should move)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
349 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
350 (insert "######")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
351 (let ((e (make-extent 4 4)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
352 (put e 'start-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
353 (put e 'end-closed t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
354 (et-insert-at "foo" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
355 (Assert (equal (et-range e) '(7 7)))))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
356
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
357 ;; closed-closed (should extend)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
358 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
359 (insert "######")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
360 (let ((e (make-extent 4 4)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
361 (put e 'end-closed t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
362 (et-insert-at "foo" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
363 (Assert (equal (et-range e) '(4 7)))))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
364
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
365 ;; open-open (illegal; forced to behave like closed-open)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
366 (with-temp-buffer
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
367 (insert "######")
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
368 (let ((e (make-extent 4 4)))
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
369 (put e 'start-open t)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
370 (et-insert-at "foo" 4)
20ae8821c23d [xemacs-hg @ 2001-04-13 09:11:17 by michaels]
michaels
parents:
diff changeset
371 (Assert (equal (et-range e) '(4 4)))))