fixed output of get-test-covergage

This commit is contained in:
Spencer Florence 2014-12-26 20:53:06 -06:00
parent 6408e7b316
commit 222b8ff090
2 changed files with 14 additions and 7 deletions

View File

@ -45,7 +45,7 @@
(set! ns (make-base-namespace))
(namespace-attach-module (current-namespace) cov ns))
;; -> [Hashof PathString (List Boolean srcloc)]
;; -> [Hashof PathString (Listof (List Boolean srcloc))]
;; returns a hash of file to a list, where the first of the list is if
;; that srcloc was covered or not
;; based on <pkgs>/drracket/drracket/private/debug.rkt
@ -75,7 +75,8 @@
[key (cadr pr)]
[old (hash-ref actions-ht key 'nothing)])
(cond
[(eq? old 'nothing) (hash-set! actions-ht key on?)]
[(eq? old 'nothing)
(hash-set! actions-ht key on?)]
[old ;; recorded as executed
(void)]
[(not old) ;; recorded as unexected
@ -87,6 +88,12 @@
;; remove redundant expressions
(define filtered (hash-map actions-ht (λ (k v) (list v k))))
(for/hash ([v filtered])
(values (srcloc-source (cadr v))
v)))
(define out (make-hash))
(for ([v filtered])
(define file (srcloc-source (cadr v)))
(hash-update! out
file
(lambda (l) (cons v l))
null))
out)

View File

@ -28,8 +28,8 @@
(define (covered? i map)
(for*/and ([l map]
[b (in-value (first map))]
[srcloc (in-value (second map))]
[b (in-value (first l))]
[srcloc (in-value (second l))]
#:when (within? i srcloc))
b))