~ chicken-core (chicken-5) /tests/pp-test.scm
Trap1;;;; pp-test.scm23(import (only chicken.pretty-print pp)4 (only chicken.port with-output-to-string)5 (only (chicken memory representation) block-ref))67(define (pp->string thing)8 (with-output-to-string (cut pp thing)))910(define-syntax test11 (syntax-rules ()12 ((_ result exp)13 (assert (equal? result exp)))))1415(test "\"\\\"foo\\\"\"\n" (pp->string "\"foo\""))16(test "\"\\\\\\\"\"\n" (pp->string "\\\""))17(test "\"\\\\\\\\\\\\\\\"\"\n" (pp->string "\\\\\\\""))18(test "\"\\\"\\\"\\\"\"\n" (pp->string "\"\"\""))19(test "\"\\n\\t\\r\\b\\a\\v\\f\"\n" (pp->string "\n\t\r\b\a\v\f"))20(test "\\" "\\") ; XXX?21(test "#<unbound value>\n" (pp->string (block-ref 'aardvark 0))) ;; Shouldn't crash