[git] CMU Common Lisp branch master updated. snapshot-2014-06-36-g33a91f6

Raymond Toy rtoy at common-lisp.net
Fri Aug 1 15:12:22 UTC 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, master has been updated
       via  33a91f6afe5d68ea41a649db6e40d93d5896fb45 (commit)
       via  b6373368fc738f43a0662545956a444da394425f (commit)
      from  7211ebf377b1b4025ab8424d6f31109fa7489479 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 33a91f6afe5d68ea41a649db6e40d93d5896fb45
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Fri Aug 1 00:01:38 2014 -0700

    Add tests for CLEAR-OUTPUT.

diff --git a/tests/fd-streams.lisp b/tests/fd-streams.lisp
new file mode 100644
index 0000000..263ce1f
--- /dev/null
+++ b/tests/fd-streams.lisp
@@ -0,0 +1,36 @@
+;;;; -*- Lisp -*-
+
+(defpackage fd-streams-tests
+  (:use #:common-lisp #:lisp-unit))
+
+(in-package #:fd-streams-tests)
+
+(defparameter *test-path*
+  (merge-pathnames (make-pathname :name :unspecific :type :unspecific
+                                  :version :unspecific)
+                   *load-truename*)
+  "Directory for temporary test files.")
+
+(defparameter *test-file*
+  (merge-pathnames #p"test-data.tmp" *test-path*))
+
+(eval-when (:load-toplevel)
+  (ensure-directories-exist *test-path* :verbose t))
+
+(define-test clear-output-1
+  (:tag :trac)
+  (assert-eql
+   0
+   (unwind-protect
+	(let ((s (open *test-file*
+		       :direction :output
+		       :if-exists :supersede)))
+	  ;; Write a character to the (fully buffered) output
+	  ;; stream. Clear the output and close the file. Nothing
+	  ;; should have been written to the file.
+	  (write-char #\a s)
+	  (clear-output s)
+	  (close s)
+	  (setf s (open *test-file*))
+	  (file-length s))
+     (delete-file *test-file*))))
diff --git a/tests/gray-streams.lisp b/tests/gray-streams.lisp
new file mode 100644
index 0000000..6308882
--- /dev/null
+++ b/tests/gray-streams.lisp
@@ -0,0 +1,39 @@
+;;;; -*- Lisp -*-
+
+(require :gray-streams)
+
+(defpackage gray-streams-tests
+  (:use #:common-lisp #:lisp-unit))
+
+(in-package #:gray-streams-tests)
+
+(defparameter *test-path*
+  (merge-pathnames (make-pathname :name :unspecific :type :unspecific
+                                  :version :unspecific)
+                   *load-truename*)
+  "Directory for temporary test files.")
+
+(defparameter *test-file*
+  (merge-pathnames #p"test-data.tmp" *test-path*))
+
+(eval-when (:load-toplevel)
+  (ensure-directories-exist *test-path* :verbose t))
+
+(define-test clear-output-1
+  (:tag :trac)
+  ;; Create a Gray stream and make sure that clear-output works.
+  (assert-eql
+   0
+   (unwind-protect
+	(let ((s (open *test-file*
+		       :direction :output
+		       :if-exists :supersede
+		       :class 'lisp::character-output-stream)))
+	  (write-char #\a s)
+	  (clear-output s)
+	  (close s)
+	  (setf s (open *test-file*))
+	  (file-length s))
+     (delete-file *test-file*))))
+		      
+    
\ No newline at end of file

commit b6373368fc738f43a0662545956a444da394425f
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Thu Jul 31 23:52:20 2014 -0700

    Implement CLEAR-OUTPUT for FD-STREAM's.
    
    This appears to be a very old bug where clear-output didn't clear the
    output for fd-streams.

diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp
index 80e2941..470dfe2 100644
--- a/src/code/fd-stream.lisp
+++ b/src/code/fd-stream.lisp
@@ -1682,7 +1682,9 @@
 	   nil
 	   (values (truncate size (fd-stream-element-size stream))))))
     (:file-position
-     (fd-stream-file-position stream arg1))))
+     (fd-stream-file-position stream arg1))
+    (:clear-output
+     (setf (fd-stream-obuf-tail stream) 0))))
 
 
 ;;; FD-STREAM-FILE-POSITION -- internal.

-----------------------------------------------------------------------

Summary of changes:
 src/code/fd-stream.lisp |    4 +++-
 tests/fd-streams.lisp   |   36 ++++++++++++++++++++++++++++++++++++
 tests/gray-streams.lisp |   39 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 tests/fd-streams.lisp
 create mode 100644 tests/gray-streams.lisp


hooks/post-receive
-- 
CMU Common Lisp



More information about the cmucl-cvs mailing list