florence / cover

a code coverage tool for racket
MIT License
38 stars 7 forks source link

Cover doesn't mark log message and argument expressions as covered #136

Closed jackfirth closed 7 years ago

jackfirth commented 7 years ago

Given this program:

#lang racket
(define-logger foo)
(log-foo-warning "blah ~v" 'foo)

Running raco cover produces the following:

screen shot 2017-07-22 at 1 45 37 am

I suspect this is caused by srcloc issues with the macros produced by define-logger.

florence commented 7 years ago

Looking at the expansion this is actually correct. The expansion gives:

(let-values (((l) foo-logger))
        (if (#%app log-level? l 'warning 'foo)
          (let-values ()
            (#%app
             log-message
             l
             'warning
             (#%app format '"blah ~v" 'foo)
             (#%app current-continuation-marks)))
          (#%app void)))

Which seams to avoid logging anything if the log-level isn't set to warning.

in the program:

#lang racket
(define-logger foo)
(make-log-receiver foo-logger 'warning)
(log-foo-warning "blah ~v" 'foo)

the message is covered.