Skip to content

Commit

Permalink
Per #24: plug gray streams protocol hole for CCL's benefit
Browse files Browse the repository at this point in the history
Contrary to SBCL and Allegro, CCL calls STREAM-LINE-COLUMN on Fiasco's
special column-counting stream, but until now we didn't have an
implementation for it.  This broke tests on CCL for packages based
on Fiasco in certain pretty-printing situations.

* src/streams.lisp (trivial-gray-streams:stream-line-column):
New method.

* test/basic.lisp (slightly-verbose-test)
(slightly-verbose-test-2): New self tests.
  • Loading branch information
joaotavora committed Sep 29, 2019
1 parent 45db6ae commit 0cc08e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/streams.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
(setf (output-column s) (- (length seq) newline-pos 1))))
(write-sequence seq (slot-value s 'understream) :start start :end end))

(defmethod trivial-gray-streams:stream-line-column
((s column-counting-output-stream))
"Tell column number that stream S is currently at."
(output-column s))

(defmethod trivial-gray-streams:stream-start-line-p
((s column-counting-output-stream))
"Tell if stream S is already at start of fresh new line."
Expand Down
8 changes: 8 additions & 0 deletions test/basic.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@
))
(values))

(deftest slightly-verbose-test ()
(format *error-output* "~&Watch out for me")
(is t))

(deftest slightly-verbose-test-2 ()
(format *error-output* "...And me")
(is t))

(deftest lambda-list-processing ()
(is (equal (lambda-list-to-value-list-expression '(p1 p2 &optional o1 (o2 "o2") &key k1 (k2 "k2") &allow-other-keys))
'(list (cons 'p1 p1) (cons 'p2 p2) (cons 'o1 o1) (cons 'o2 o2) (cons 'k1 k1)
Expand Down

0 comments on commit 0cc08e7

Please # to comment.