From 150a160960c6dd283395f3d1fcc9a28bbdf3bcf8 Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Thu, 6 Jun 2019 19:34:00 -0400 Subject: [PATCH] fix part of #53, assertion failure in print_traverse --- print.c | 3 +++ tests/unittest.lsp | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/print.c b/print.c index b749853..993aafa 100644 --- a/print.c +++ b/print.c @@ -89,6 +89,9 @@ void print_traverse(value_t v) for(i=0; i < vector_size(v); i++) print_traverse(vector_elt(v,i)); } + else if (iscprim(v)) { + // don't consider shared references to e.g. chars + } else if (isclosure(v)) { mark_cons(v); function_t *f = (function_t*)ptr(v); diff --git a/tests/unittest.lsp b/tests/unittest.lsp index 1046b7f..e338ded 100644 --- a/tests/unittest.lsp +++ b/tests/unittest.lsp @@ -292,5 +292,14 @@ (assert (equal? 1.0 (* 1.0 1))) ; tests that * no longer does inexact->exact +(define (with-output-to-string nada thunk) + (let ((b (buffer))) + (with-output-to b (thunk)) + (io.tostring! b))) + +(let ((c #\a)) + (assert (equal? (with-output-to-string #f (lambda () (print (list c c)))) + "(#\\a #\\a)"))) + (princ "all tests pass\n") #t