From 222b8ff09072d521a88f201e1029cd1c73e5399b Mon Sep 17 00:00:00 2001 From: Spencer Florence Date: Fri, 26 Dec 2014 20:53:06 -0600 Subject: [PATCH] fixed output of get-test-covergage --- main.rkt | 17 ++++++++++++----- tests/main.rkt | 4 ++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/main.rkt b/main.rkt index 667e168..3d77b0f 100644 --- a/main.rkt +++ b/main.rkt @@ -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 /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) diff --git a/tests/main.rkt b/tests/main.rkt index bf51b95..90be713 100644 --- a/tests/main.rkt +++ b/tests/main.rkt @@ -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))