From 5691dfef97cbe86fd49b0ac51c40b7d33b1682bc Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 2 Dec 2018 03:29:16 +0000 Subject: [PATCH] pp doesn't respect custom print methods for tagged vectors. --- tests/runtime/test-pp.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/runtime/test-pp.scm b/tests/runtime/test-pp.scm index 9b84ff223..6ccd930ad 100644 --- a/tests/runtime/test-pp.scm +++ b/tests/runtime/test-pp.scm @@ -105,3 +105,23 @@ USA. ;; XXX Figure out what string it should print by hand. (assert-string (carefully doit (lambda () 'stack-overflow) (lambda () 'timeout))))))) + +(define-test 'custom + (lambda () + (expect-failure + (lambda () + (let ((tag (cons 0 0))) + (define (loser? object) + (and (vector? object) + (<= 1 (vector-length object)) + (eq? tag (vector-ref object 0)))) + (register-predicate! loser? 'loser? '<= vector?) + (define-print-method loser? + (standard-print-method + (lambda (object) object "LOSER") + (lambda (object) object '(42)))) + (let* ((loser (make-vector 1000 tag)) + (hash (number->string (hash-object loser)))) + (assert-equal + (call-with-output-string (lambda (port) (pp loser port))) + (string-append "#[LOSER " hash " 42]\n")))))))) -- 2.25.1