From 0cc08e798b10298e7a03254034305a77bf7eb063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 29 Sep 2019 18:10:27 +0100 Subject: [PATCH] Per #24: plug gray streams protocol hole for CCL's benefit 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. --- src/streams.lisp | 5 +++++ test/basic.lisp | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/streams.lisp b/src/streams.lisp index 8ee027e..a8742cf 100644 --- a/src/streams.lisp +++ b/src/streams.lisp @@ -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." diff --git a/test/basic.lisp b/test/basic.lisp index 5dcb091..507b9cb 100644 --- a/test/basic.lisp +++ b/test/basic.lisp @@ -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)