[climacs-cvs] CVS update: climacs/buffer-test.lisp climacs/buffer.lisp

Aleksandar Bakic abakic at common-lisp.net
Sat Feb 5 20:59:52 UTC 2005


Update of /project/climacs/cvsroot/climacs
In directory common-lisp.net:/tmp/cvs-serv1016

Modified Files:
	buffer-test.lisp buffer.lisp 
Log Message:
Introduced p-mark-mixin class to separate methods related to the
standard-buffer and its marks, from those related to the persistent
buffers and their marks.

Also added a few tests for (setf buffer-object).

Date: Sat Feb  5 21:59:50 2005
Author: abakic

Index: climacs/buffer-test.lisp
diff -u climacs/buffer-test.lisp:1.11 climacs/buffer-test.lisp:1.12
--- climacs/buffer-test.lisp:1.11	Sat Feb  5 14:49:20 2005
+++ climacs/buffer-test.lisp	Sat Feb  5 21:59:49 2005
@@ -459,6 +459,29 @@
       (= (climacs-buffer::condition-offset c) 8)))
   t)
 
+(deftest standard-buffer-setf-buffer-object.test-1
+  (let ((buffer (make-instance 'standard-buffer)))
+    (insert-buffer-sequence buffer 0 "climacs")
+    (setf (buffer-object buffer 0) #\C)
+    (buffer-sequence buffer 0 (size buffer)))
+  "Climacs")
+
+(deftest standard-buffer-setf-buffer-object.test-2
+  (handler-case
+      (let ((buffer (make-instance 'standard-buffer)))
+	(setf (buffer-object buffer 0) #\a))
+    (climacs-buffer::no-such-offset (c)
+      (= (climacs-buffer::condition-offset c) 0)))
+  t)
+
+(deftest standard-buffer-setf-buffer-object.test-3
+  (handler-case
+      (let ((buffer (make-instance 'standard-buffer)))
+	(setf (buffer-object buffer -1) #\a))
+    (climacs-buffer::no-such-offset (c)
+      (= (climacs-buffer::condition-offset c) -1)))
+  t)
+
 (deftest standard-buffer-mark<.test-1
   (handler-case
       (let ((buffer (make-instance 'standard-buffer))


Index: climacs/buffer.lisp
diff -u climacs/buffer.lisp:1.26 climacs/buffer.lisp:1.27
--- climacs/buffer.lisp:1.26	Sat Feb  5 14:49:20 2005
+++ climacs/buffer.lisp	Sat Feb  5 21:59:50 2005
@@ -88,12 +88,12 @@
 
 (defgeneric backward-object (mark &optional count))
 
-(defmethod backward-object ((mark mark) &optional (count 1))
+(defmethod backward-object ((mark mark-mixin) &optional (count 1))
   (decf (offset mark) count))
 
 (defgeneric forward-object (mark &optional count))
 
-(defmethod forward-object ((mark mark) &optional (count 1))
+(defmethod forward-object ((mark mark-mixin) &optional (count 1))
   (incf (offset mark) count))
 
 (defclass standard-left-sticky-mark (left-sticky-mark mark-mixin) ()
@@ -297,7 +297,7 @@
 either immediately before the closest following newline character, or
 at the end of the buffer if no following newline character exists."))
 
-(defmethod end-of-line ((mark mark-mixin)) ;PB
+(defmethod end-of-line ((mark mark-mixin))
   (let* ((offset (offset mark))
 	 (buffer (buffer mark))
 	 (chain (slot-value buffer 'contents))




More information about the Climacs-cvs mailing list