Update of /project/climacs/cvsroot/climacs/Persistent In directory common-lisp.net:/tmp/cvs-serv12175/Persistent
Modified Files: persistent-base-test.lisp persistent-buffer-test.lisp persistent-buffer.lisp Log Message: Changes to (un)tabify-*region methods, and corresponding tests.
Initial tests for indent-line.
Date: Sun Feb 6 01:03:30 2005 Author: abakic
Index: climacs/Persistent/persistent-base-test.lisp diff -u climacs/Persistent/persistent-base-test.lisp:1.4 climacs/Persistent/persistent-base-test.lisp:1.5 --- climacs/Persistent/persistent-base-test.lisp:1.4 Sat Jan 29 23:23:14 2005 +++ climacs/Persistent/persistent-base-test.lisp Sun Feb 6 01:03:29 2005 @@ -768,6 +768,110 @@ (offset m)))) "Cli Ma Cs climacs" 9)
+(deftest binseq-buffer-tabify-buffer-region.test-1 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::tabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest binseq-buffer-tabify-buffer-region.test-2 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::tabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest binseq-buffer-tabify-region.test-1 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 7))) + (tabify-region m2 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest binseq-buffer-tabify-region.test-2 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 3))) + (tabify-region 7 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest binseq-buffer-tabify-region.test-3 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 7))) + (tabify-region 3 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest binseq-buffer-untabify-buffer-region.test-1 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::untabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest binseq-buffer-untabify-buffer-region.test-2 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::untabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest binseq-buffer-untabify-region.test-1 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 5))) + (untabify-region m2 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest binseq-buffer-untabify-region.test-2 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 3))) + (untabify-region 5 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest binseq-buffer-untabify-region.test-3 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 5))) + (untabify-region 3 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest binseq-buffer-indent-line.test-1 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 " climacs ") + (let ((m (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 0))) + (indent-line m 4 nil) + (buffer-sequence buffer 0 (size buffer)))) + " climacs ") + +(deftest binseq-buffer-indent-line.test-2 + (let ((buffer (make-instance 'binseq-buffer))) + (insert-buffer-sequence buffer 0 " climacs ") + (let ((m (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 0))) + (indent-line m 5 4) + (buffer-sequence buffer 0 (size buffer)))) + " climacs ") + ;;; obinseq tests
(deftest obinseq-buffer-previous-line.test-1 @@ -1514,4 +1618,108 @@ (values (buffer-sequence buffer 0 (size buffer)) (offset m)))) - "Cli Ma Cs" 9) \ No newline at end of file + "Cli Ma Cs" 9) + +(deftest obinseq-buffer-tabify-buffer-region.test-1 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::tabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest obinseq-buffer-tabify-buffer-region.test-2 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::tabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest obinseq-buffer-tabify-region.test-1 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 7))) + (tabify-region m2 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest obinseq-buffer-tabify-region.test-2 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 3))) + (tabify-region 7 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest obinseq-buffer-tabify-region.test-3 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 7))) + (tabify-region 3 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest obinseq-buffer-untabify-buffer-region.test-1 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::untabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest obinseq-buffer-untabify-buffer-region.test-2 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "c l im acs") + (climacs-base::untabify-buffer-region buffer 0 (size buffer) 8) + (buffer-sequence buffer 0 (size buffer))) + "c l im acs") + +(deftest obinseq-buffer-untabify-region.test-1 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 5))) + (untabify-region m2 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest obinseq-buffer-untabify-region.test-2 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 3))) + (untabify-region 5 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest obinseq-buffer-untabify-region.test-3 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 "clim acs") + (let ((m1 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 5))) + (untabify-region 3 m1 4) + (buffer-sequence buffer 0 (size buffer)))) + "clim acs") + +(deftest obinseq-buffer-indent-line.test-1 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 " climacs ") + (let ((m (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 0))) + (indent-line m 4 nil) + (buffer-sequence buffer 0 (size buffer)))) + " climacs ") + +(deftest obinseq-buffer-indent-line.test-2 + (let ((buffer (make-instance 'obinseq-buffer))) + (insert-buffer-sequence buffer 0 " climacs ") + (let ((m (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 0))) + (indent-line m 5 4) + (buffer-sequence buffer 0 (size buffer)))) + " climacs ")
Index: climacs/Persistent/persistent-buffer-test.lisp diff -u climacs/Persistent/persistent-buffer-test.lisp:1.6 climacs/Persistent/persistent-buffer-test.lisp:1.7 --- climacs/Persistent/persistent-buffer-test.lisp:1.6 Sat Feb 5 22:34:44 2005 +++ climacs/Persistent/persistent-buffer-test.lisp Sun Feb 6 01:03:29 2005 @@ -248,11 +248,14 @@ (let ((buffer (make-instance 'binseq-buffer))) (insert-buffer-sequence buffer 0 "climacs") (let ((m (make-instance 'persistent-left-sticky-mark - :buffer buffer :offset 3))) + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 5))) (insert-sequence m "ClimacS") (and (= (size buffer) 14) (eq (buffer m) buffer) (= (offset m) 3) + (= (offset m2) 12) (buffer-sequence buffer 0 14)))) "cliClimacSmacs")
@@ -260,11 +263,14 @@ (let ((buffer (make-instance 'binseq-buffer))) (insert-buffer-sequence buffer 0 "climacs") (let ((m (make-instance 'persistent-right-sticky-mark - :buffer buffer :offset 3))) + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 5))) (insert-sequence m "ClimacS") (and (= (size buffer) 14) (eq (buffer m) buffer) (= (offset m) 10) + (= (offset m2) 12) (buffer-sequence buffer 0 14)))) "cliClimacSmacs")
@@ -1062,11 +1068,14 @@ (let ((buffer (make-instance 'obinseq-buffer))) (insert-buffer-sequence buffer 0 "climacs") (let ((m (make-instance 'persistent-left-sticky-mark - :buffer buffer :offset 3))) + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-left-sticky-mark + :buffer buffer :offset 5))) (insert-sequence m "ClimacS") (and (= (size buffer) 14) (eq (buffer m) buffer) (= (offset m) 3) + (= (offset m2) 12) (buffer-sequence buffer 0 14)))) "cliClimacSmacs")
@@ -1074,11 +1083,14 @@ (let ((buffer (make-instance 'obinseq-buffer))) (insert-buffer-sequence buffer 0 "climacs") (let ((m (make-instance 'persistent-right-sticky-mark - :buffer buffer :offset 3))) + :buffer buffer :offset 3)) + (m2 (make-instance 'persistent-right-sticky-mark + :buffer buffer :offset 5))) (insert-sequence m "ClimacS") (and (= (size buffer) 14) (eq (buffer m) buffer) (= (offset m) 10) + (= (offset m2) 12) (buffer-sequence buffer 0 14)))) "cliClimacSmacs")
Index: climacs/Persistent/persistent-buffer.lisp diff -u climacs/Persistent/persistent-buffer.lisp:1.4 climacs/Persistent/persistent-buffer.lisp:1.5 --- climacs/Persistent/persistent-buffer.lisp:1.4 Sat Feb 5 21:59:51 2005 +++ climacs/Persistent/persistent-buffer.lisp Sun Feb 6 01:03:29 2005 @@ -145,15 +145,15 @@ (setf high-mark (make-instance 'persistent-right-sticky-mark :buffer buffer))))
-(defmethod clone-mark ((mark persistent-left-sticky-mark) &optional type) - (unless type - (setf type 'persistent-left-sticky-mark)) - (make-instance type :buffer (buffer mark) :offset (offset mark))) +;; (defmethod clone-mark ((mark persistent-left-sticky-mark) &optional type) +;; (unless type +;; (setf type 'persistent-left-sticky-mark)) +;; (make-instance type :buffer (buffer mark) :offset (offset mark)))
-(defmethod clone-mark ((mark persistent-right-sticky-mark) &optional type) - (unless type - (setf type 'persistent-right-sticky-mark)) - (make-instance type :buffer (buffer mark) :offset (offset mark))) +;; (defmethod clone-mark ((mark persistent-right-sticky-mark) &optional type) +;; (unless type +;; (setf type 'persistent-right-sticky-mark)) +;; (make-instance type :buffer (buffer mark) :offset (offset mark)))
(defmethod size ((buffer binseq-buffer)) (binseq-length (slot-value buffer 'contents)))