[racket] get-uncovered-expressions

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jul 21 18:19:00 EDT 2010

On Jul 21, Nadeem Abdul Hamid wrote:
> Sorry if I am missing something obvious, by why does the following
> produce '() ?
> (define Ev
>   (parameterize ([sandbox-coverage-enabled #t])
>     (make-evaluator 'lang/htdp-intermediate
>                     `(define (f x)
>                        (if (zero? x) "zero" "non-zero"))
>                     `(f 4)
>                     )))
> (get-uncovered-expressions Ev)
> I would have expected it to indicate somehow that the "zero" case is
> not covered?

I can't produce a more thorough answer now, but in general the whole
uncovered expressions feature relies on expressions with a source
indication.  For example, this works as you expect:

  (define Ev
    (parameterize ([sandbox-coverage-enabled #t])
      (make-evaluator 'lang/htdp-intermediate
                      "(define (f x)
                          (if (zero? x) \"zero\" \"non-zero\"))
                       (f 4)"
  (get-uncovered-expressions Ev)

and it should also work for a sandbox that is created from a file.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the users mailing list.