[racket] get-uncovered-expressions

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Wed Jul 21 18:39:44 EDT 2010

> 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:
> ...
> and it should also work for a sandbox that is created from a file.


OK, thanks, that sort of makes sense. But still, if I put the text of the program in a file and do the following it still produces '()...

 (define Ev
   (call-with-input-file* "test.rkt" 
     (λ(inp)
       (parameterize ([sandbox-coverage-enabled #t])
         (make-evaluator 'lang/htdp-intermediate
                         inp
                         )))))
 (get-uncovered-expressions Ev)

And so does this:

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


--- nadeem


On Jul 21, 2010, at 6:19 PM, Eli Barzilay wrote:

> 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.