[plt-scheme] Testing compilation of code

From: Noel Welsh (noelwelsh at yahoo.com)
Date: Fri Feb 3 16:23:52 EST 2006

Hi all,

As some are aware there is a bug in SchemeUnit v2 caused by
a 3D value.  Attempting to compile a path is causing the
errors people have observed with Planet.

I've decided to skip straight to v3, and not bother fixing
v2.  However I'm having trouble testing this.  Below is the
old test (obviously broken) from SchemeUnit v2.  I really
don't understand what it is doing.  I though it would be
sufficient to compile an assertion, and then
dynamic-require it.  This should be done in a new

So the question: what's a reasonable test to ensure code is


      "assertions are compilable"
      (let ((destns (make-namespace))
            (cns (current-namespace)))
        (parameterize ((current-namespace destns))
          (namespace-require `(,(#%info-lookup
          ;; First check that the right assert macro got
used: ie that
          ;; it didn't just compile the thing as an
          (let ((ecode (syntax-object->datum (expand
'(assert = 1 2)))))
            (assert-false (and (pair? ecode)
                               (eq? (car ecode) '#%app)
                               (pair? (cdr ecode))
                               (equal? (cadr ecode) '(#%top
. assert)))))
          ;; Then check to make sure that the compiled code
is writable even
          ;; in the presence of strange syntax-source
          (let ((stx-string "(assert = 1 2)"))
            (write (compile (read-syntax (string->path
            (write (compile (read-syntax (let-struct A ()

Email: noelwelsh <at> yahoo <dot> com   noel <at> untyped <dot> com
AIM: noelhwelsh
Blogs: http://monospaced.blogspot.com/  http://www.untyped.com/untyping/

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

Posted on the users mailing list.