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